你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

az aks namespace

Note

This reference is part of the aks-preview extension for the Azure CLI (version 2.61.0 or higher). 该扩展将在首次运行 az aks namespace 命令时自动安装。 Learn more about extensions.

此命令组处于预览状态,正在开发中。 参考和支持级别:https://aka.ms/CLI_refstatus

用于管理托管 Kubernetes 群集中的命名空间的命令。

命令

名称 说明 类型 Status
az aks namespace add

将命名空间添加到托管 Kubernetes 群集。

Extension Preview
az aks namespace delete

删除托管 Kubernetes 群集中的托管命名空间。

Extension Preview
az aks namespace get-credentials

获取托管命名空间的访问凭据。

Extension Preview
az aks namespace list

列出托管 Kubernetes 群集中的托管命名空间。

Extension Preview
az aks namespace show

显示托管 Kubernetes 群集中托管命名空间的详细信息。

Extension Preview
az aks namespace update

更新托管 Kubernetes 群集上的命名空间。

Extension Preview

az aks namespace add

预览

命令组“aks 命名空间”处于预览状态,正在开发中。 参考和支持级别:https://aka.ms/CLI_refstatus

将命名空间添加到托管 Kubernetes 群集。

az aks namespace add --cluster-name
                     --cpu-limit
                     --cpu-request
                     --memory-limit
                     --memory-request
                     --name
                     --resource-group
                     [--adoption-policy {Always, IfIdentical, Never}]
                     [--aks-custom-headers]
                     [--annotations]
                     [--delete-policy {Delete, Keep}]
                     [--egress-policy {AllowAll, AllowSameNamespace, DenyAll}]
                     [--ingress-policy {AllowAll, AllowSameNamespace, DenyAll}]
                     [--labels]
                     [--no-wait]
                     [--tags]

示例

在现有 AKS 群集中创建命名空间。

az aks namespace add -g MyResourceGroup --cluster-name MyClusterName --name NamespaceName --cpu-request 500m --cpu-limit 800m --memory-request 1Gi --memory-limit 2Gi --aks-custom-headers AKSHTTPCustomFeatures=Microsoft.ContainerService/ManagedNamespacePreview

在具有标签、注释和标记的现有 AKS 群集中创建命名空间

az aks namespace add -g MyResourceGroup --cluster-name MyClusterName --name NamespaceName --labels a=b p=q --annotations a=b p=q --tags a=b p=q --cpu-request 500m --cpu-limit 800m --memory-request 1Gi --memory-limit 2Gi --aks-custom-headers AKSHTTPCustomFeatures=Microsoft.ContainerService/ManagedNamespacePreview

必需参数

--cluster-name

托管群集的名称。

--cpu-limit

命名空间的 CPU 限制。

--cpu-request

命名空间的 CPU 请求。

--memory-limit

命名空间的内存限制。

--memory-request

命名空间的内存请求。

--name -n

托管命名空间名称。

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name>配置默认组。

可选参数

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--adoption-policy

如果已存在同名的 Kubernetes 命名空间,则执行作。 默认值为“从不”。

属性
接受的值: Always, IfIdentical, Never
--aks-custom-headers

发送自定义标头。 指定时,格式应为 Key1=Value1,Key2=Value2。

--annotations

托管命名空间的注释。

--delete-policy

删除命名空间的选项。 默认值为 Keep。

属性
接受的值: Delete, Keep
--egress-policy

网络的出口策略。 默认值为 AllowAll。

属性
接受的值: AllowAll, AllowSameNamespace, DenyAll
--ingress-policy

网络的入口策略。 默认值为 AllowSameNamespace。

属性
接受的值: AllowAll, AllowSameNamespace, DenyAll
--labels

托管命名空间的标签。

--no-wait

不等待长时间运行的操作完成。

属性
默认值: False
--tags

托管命名空间的标记。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

属性
默认值: False
--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

属性
默认值: False
--output -o

Output format.

属性
默认值: json
接受的值: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

增加日志记录详细程度。 使用 --debug 获取完整的调试日志。

属性
默认值: False

az aks namespace delete

预览

命令组“aks 命名空间”处于预览状态,正在开发中。 参考和支持级别:https://aka.ms/CLI_refstatus

删除托管 Kubernetes 群集中的托管命名空间。

az aks namespace delete --cluster-name
                        --name
                        --resource-group
                        [--no-wait]

必需参数

--cluster-name

群集名称。

--name -n

托管命名空间名称。

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name>配置默认组。

可选参数

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--no-wait

不等待长时间运行的操作完成。

属性
默认值: False
全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

属性
默认值: False
--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

属性
默认值: False
--output -o

Output format.

属性
默认值: json
接受的值: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

增加日志记录详细程度。 使用 --debug 获取完整的调试日志。

属性
默认值: False

az aks namespace get-credentials

预览

命令组“aks 命名空间”处于预览状态,正在开发中。 参考和支持级别:https://aka.ms/CLI_refstatus

获取托管命名空间的访问凭据。

az aks namespace get-credentials --cluster-name
                                 --name
                                 --resource-group
                                 [--context]
                                 [--file]
                                 [--overwrite-existing]

示例

获取托管命名空间的访问凭据。 (autogenerated)

az aks namespace get-credentials --resource-group MyResourceGroup --cluster-name MyManagedCluster --name ManagedNamespaceName

必需参数

--cluster-name

群集名称。

--name -n

托管命名空间名称。

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name>配置默认组。

可选参数

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--context

如果指定,请覆盖默认上下文名称。

--file -f

要更新的 Kubernetes 配置文件。 改用“-”将 YAML 打印为 stdout。

属性
默认值: ~\.kube\config
--overwrite-existing

覆盖具有相同名称的任何现有群集条目。

属性
默认值: False
全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

属性
默认值: False
--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

属性
默认值: False
--output -o

Output format.

凭据始终采用 YAML 格式,因此实际上忽略此参数。

属性
默认值: json
接受的值: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

增加日志记录详细程度。 使用 --debug 获取完整的调试日志。

属性
默认值: False

az aks namespace list

预览

命令组“aks 命名空间”处于预览状态,正在开发中。 参考和支持级别:https://aka.ms/CLI_refstatus

列出托管 Kubernetes 群集中的托管命名空间。

az aks namespace list [--cluster-name]
                      [--resource-group]

可选参数

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--cluster-name

群集名称。

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name>配置默认组。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

属性
默认值: False
--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

属性
默认值: False
--output -o

Output format.

属性
默认值: json
接受的值: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

增加日志记录详细程度。 使用 --debug 获取完整的调试日志。

属性
默认值: False

az aks namespace show

预览

命令组“aks 命名空间”处于预览状态,正在开发中。 参考和支持级别:https://aka.ms/CLI_refstatus

显示托管 Kubernetes 群集中托管命名空间的详细信息。

az aks namespace show --cluster-name
                      --name
                      --resource-group

必需参数

--cluster-name

群集名称。

--name -n

托管命名空间名称。

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name>配置默认组。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

属性
默认值: False
--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

属性
默认值: False
--output -o

Output format.

属性
默认值: json
接受的值: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

增加日志记录详细程度。 使用 --debug 获取完整的调试日志。

属性
默认值: False

az aks namespace update

预览

命令组“aks 命名空间”处于预览状态,正在开发中。 参考和支持级别:https://aka.ms/CLI_refstatus

更新托管 Kubernetes 群集上的命名空间。

az aks namespace update --cluster-name
                        --name
                        --resource-group
                        [--adoption-policy {Always, IfIdentical, Never}]
                        [--aks-custom-headers]
                        [--annotations]
                        [--cpu-limit]
                        [--cpu-request]
                        [--delete-policy {Delete, Keep}]
                        [--egress-policy {AllowAll, AllowSameNamespace, DenyAll}]
                        [--ingress-policy {AllowAll, AllowSameNamespace, DenyAll}]
                        [--labels]
                        [--memory-limit]
                        [--memory-request]
                        [--no-wait]
                        [--tags]

示例

更新现有 AKS 群集中的命名空间。

az aks namespace update -g MyResourceGroup --cluster-name MyClusterName --name NamespaceName --labels a=b p=q --annotations a=b p=q --tags a=b p=q --cpu-request 600m --cpu-limit 800m --memory-request 2Gi --memory-limit 3Gi --adoption-policy Always --aks-custom-headers AKSHTTPCustomFeatures=Microsoft.ContainerService/ManagedNamespacePreview

必需参数

--cluster-name

托管群集的名称。

--name -n

托管命名空间名称。

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name>配置默认组。

可选参数

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--adoption-policy

如果已存在同名的 Kubernetes 命名空间,则执行作。

属性
接受的值: Always, IfIdentical, Never
--aks-custom-headers

发送自定义标头。 指定时,格式应为 Key1=Value1,Key2=Value2。

--annotations

托管命名空间的注释。

--cpu-limit

命名空间的 CPU 限制。

--cpu-request

命名空间的 CPU 请求。

--delete-policy

删除命名空间的选项。

属性
接受的值: Delete, Keep
--egress-policy

网络的出口策略规则。

属性
接受的值: AllowAll, AllowSameNamespace, DenyAll
--ingress-policy

网络的入口策略规则。

属性
接受的值: AllowAll, AllowSameNamespace, DenyAll
--labels

托管命名空间的标签。

--memory-limit

命名空间的内存限制。

--memory-request

命名空间的内存请求。

--no-wait

不等待长时间运行的操作完成。

属性
默认值: False
--tags

托管命名空间的标记。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

属性
默认值: False
--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

属性
默认值: False
--output -o

Output format.

属性
默认值: json
接受的值: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

增加日志记录详细程度。 使用 --debug 获取完整的调试日志。

属性
默认值: False