Manage namespaces using the saectl tool

更新时间:
复制 MD 格式

SAE namespaces map to the Namespace resource type in Kubernetes. Use the saectl tool to create, list, view, and delete namespaces. Updating an existing namespace is not supported.

Prerequisites

Before you begin, ensure that you have:

Create a namespace

  1. Create a file named namespace.yaml with the following content:

    apiVersion: v1
    kind: Namespace
    metadata:
      annotations:
        sae.aliyun.com/vpc-id: vpc-xxxxxxxxxxxxxxxxxxxx # VPC ID
      name: demo # Namespace ID
    spec: {}

    For a description of each field, see YAML configuration reference.

  2. In the directory where namespace.yaml is located, run:

    saectl apply -f namespace.yaml

List namespaces

saectl get ns

The output lists all namespaces in the configured region:

NAME      STATUS   REGION
default   Active   cn-hangzhou
demo      Active   cn-hangzhou
FieldDescription
NAMEThe namespace ID. default indicates the default namespace.
STATUSThe namespace status. Active means the namespace is ready to use.
REGIONThe region where the namespace resides.

View namespace details

Use get for a compact YAML or JSON summary, or describe for the full human-readable output.

Get a namespace summary:

saectl get ns <namespace-id> -o yaml

Replace <namespace-id> with the namespace ID. Use -o json to get JSON output instead.

Describe a namespace:

saectl describe ns <namespace-id>

The describe output includes the full configuration of the namespace, including its annotations and status. This is useful when you need to confirm the VPC association or check the current status.

Delete a namespace

saectl delete ns <namespace-id>

Replace <namespace-id> with the namespace ID.

YAML configuration reference

The following table describes the YAML fields for SAE namespaces.

FieldDescriptionRequired on create
metadata.nameThe namespace ID.Yes
metadata.annotations: sae.aliyun.com/vpc-idThe ID of the VPC to associate with the namespace.Yes
metadata.annotations: sae.aliyun.com/regionThe region where the namespace resides.Not supported — read-only.
status.phaseThe namespace status.Not supported — read-only.