文档

诊断工具asmctl常用命令

更新时间:

本文介绍诊断工具asmctl常用命令。

兼容性说明

ASM不保证兼容社区Istio社区诊断工具Istioctl,但是ASM提供诊断工具asmctl,该工具当前支持Istioctl部分命令。

诊断工具asmctl支持在以下版本的ACK集群和ASM中使用:

  • v1.8.6.49-gda24841c-aliyun及以上版本的ASM标准版。

  • v1.20.4-aluyun-1及以上版本的ACK Pro托管版集群。

目前,不保证在v1.8.6.49-gda24841c-aliyun以下ASM标准版中使用asmctl时,所有命令的可用性。

使用限制

asmctl支持的命令与社区提供的Istioctl工具的1.9版本相兼容。由于服务网格ASM的托管特性,asmctl当前仅支持部分Istioctl命令,当前不支持的命令及其原因如下:

命令

当前不支持原因

dashboard系列命令中,除dashboard envoy以外的命令

服务网格控制面由ASM托管,不支持通过命令行工具对控制面核心组件及服务网格自建可观测性。

create-remote-secret

服务网格控制面由ASM托管,不支持自行为控制面创建Secret访问远程Kubernetes集群。

istiod

服务网格控制面由ASM托管,不支持通过命令行工具管理控制面核心组件。

metrics

服务网格控制面由ASM托管,不支持通过命令行工具对控制面核心组件及服务网格自建可观测性。

precheck

服务网格控制面由ASM托管,asmctl无需提供Istio兼容性检查相关功能。

proxy-status

服务网格控制面由ASM托管,当前不支持通过命令行工具自行查询控制面状态,您可以在服务网格控制台概览页面查看网格状态。

uninstall、install

服务网格控制面由ASM托管,不支持自行安装、卸载控制面。

version

当前不支持查看版本信息,可以通过服务网格控制台查看网格基础信息。

wait

服务网格控制面由ASM托管,当前开发进度下不支持通过命令行工具自行查询控制面状态。

manifest、operator、profile、upgrade、verify-install

服务网格控制面由ASM托管,asmctl不提供通过命令在用户侧集群中再次安装istio的能力。

kube-inject、kube-uninject、workload、add-to-mesh系列命令、remove-from-mesh命令

asmctl还处于开发早期阶段,目前暂时不开放会对集群进行实质性更改的命令。

asmctl命令概览

命令

描述

链接

asmctl analyze

分析集群的控制面配置并输出分析结果。

asmctl analyze

asmctl bug-report

选择性地收集ASM实例与用户侧集群中的信息与日志,并压缩到一个压缩包,帮助您对常见问题进行诊断。

asmctl bug-report

asmctl dashboard

访问与社区Istio兼容的Web UI。

asmctl dashboard

asmctl dashboard envoy

为指定容器组的Sidecar打开Envoy管理面板。

asmctl dashboard envoy

asmctl experimental

这些命令还在开发中,属于实验性命令。

asmctl experimental

asmctl experimental authz

提供与服务网格授权策略有关的功能。

asmctl experimental authz

asmctl experimental authz check

检查指定容器组的Sidecar配置,并输出应用在该容器组Sidecar上的所有授权策略。

asmctl experimental authz check

asmctl experimental config

提供与服务网格默认设置有关的功能。

asmctl experimental config

asmctl experimental config list

列出服务网格中可配置的默认设置信息。

asmctl experimental config list

asmctl experimental describe

输出有关指定Kubernetes资源以及与其相关的服务网格配置的描述性信息。

asmctl experimental describe

asmctl experimental describe pod

根据指定的容器组,分析与它相关的Kubernetes服务、目标规则和虚拟服务等,并最终输出与该容器组相关的描述性信息。

asmctl experimental describe pod

asmctl experimental describe service

根据指定的Kubernetes服务,结合分析与之相关的容器组、目标规则和虚拟服务等,并最终输出与该Kubernetes服务相关的描述性信息。

asmctl experimental describe service

asmctl experimental injector

负责与Sidecar注入情况以及Sidecar注入器信息有关的功能。

asmctl experimental injector

asmctl experimental injector list

列出每个命名空间中容器组Sidecar的注入情况,并输出ASM使用的Sidecar注入器的概要信息。

asmctl experimental injector list

asmctl proxy-config

负责获取容器组中Sidecar的配置信息。

asmctl proxy-config

asmctl proxy-config bootstrap

负责获取指定容器组中Sidecar Envoy的bootstrap配置信息。

asmctl proxy-config bootstrap

asmctl proxy-config cluster

负责获取指定容器组中Sidecar Envoy的cluster配置信息。

asmctl proxy-config cluster

asmctl proxy-config endpoint

负责获取指定容器组中Sidecar Envoy的Endpoint配置信息。

asmctl proxy-config endpoint

asmctl proxy-config listener

负责获取指定容器组中Sidecar Envoy的Listener配置信息。

asmctl proxy-config listener

asmctl proxy-config log

负责获取Sidecar Envoy的日志等级信息,并且支持选择性地更新日志。

asmctl proxy-config log

asmctl proxy-config route

负责获取指定容器组中Sidecar Envoy的Route配置信息。

asmctl proxy-config route

asmctl proxy-config secret

负责获取指定容器组中Sidecar Envoy的Secret配置信息。

asmctl proxy-config secret

asmctl validate

负责验证服务网格规则与策略文件的正确性。

asmctl validate

asmctl analyze

analyze命令分析集群的控制面配置并输出分析结果。

asmctl analyze <file>... [flags]

选项

选项缩写

描述

--all-namespaces

-A

分析所有的命名空间。

--asmconfig <string>

-m

设置ASM实例的kubeconfig文件路径,默认为$HOME/.kube/asmconfig

--color

是否以带颜色的格式输出分析结果,默认为true,可设定为false

--context <string>

设置默认使用的kubeconfig context名称,默认为空。

--failure-threshold <Level>

设定分析时在何种等级下会返回非0的错误码。可用的值包括:InfoWarning Error,默认为Error

--istioNamespace <string>

-i

设置Istio所在命名空间名称,默认为istio-system

--kubeconfig <string>

-c

设置用户侧集群的kubeconfig文件路径,默认为空。

--list-analyzers

-L

列出analyze命令当前执行的所有分析手段。

--meshConfigFile <string>

在分析时使用给定的网格配置文件来覆盖当前的网格配置,默认为空。

--namespace <string>

-n

指定生效的命名空间,默认为空。

--output <string>

-o

设定输出的格式,可用的值包括:logjsonyaml ,默认为空。

--output-threshold <Level>

设定分析时在何种等级下会输出消息。可用的值包括:InfoWarning Error,默认为Info

--recursive

-R

在指定了分析目录时,递归地处理目录中的所有文件,而不是仅分析目录中的第一层文件。

--suppress <stringArray>

-S

设定停止报告某个特定资源的某个消息码。该项以<code>=<resource>的形式提供,例如--suppress "IST0102=DestinationRule primary-dr.default。该项可以重复提供,且可以在传入的参数中使用通配符“*”来支持部分匹配,例如suppress "IST0102=DestinationRule *.default。该项默认为[]

--timeout <duration>

设置命令返回超时错误的时间,执行分析超过超时时间后会返回timeout错误而不再返回分析结果,默认为30s

--use-kube

-k

是否基于当前的ASM实例与用户侧集群进行分析,如果只是想要分析文件本身,则需将此项设定为use-kube=false

--verbose

-v

设定输出详细的分析过程。

以下为asmctl analyze命令示例:

# 分析当前的用户侧集群和ASM实例的控制面配置信息。
asmctl analyze

# 分析当前的用户侧集群和ASM实例,模拟分析在应用a.yaml、b.yaml与my-app-config目录中的配置文件后产生的效果。
asmctl analyze a.yaml b.yaml my-app-config/

# 分析当前的用户侧集群和ASM实例,模拟分析在应用了a.yaml、b.yaml与my-app-config目录中的配置文件后产生的效果,同时指定了需要分析的用户侧集群与和ASM实例的kubeconfig文件。
asmctl analyze a.yaml b.yaml my-app-config/ -c ~/.kube/ackconfig1 -m ~/.kube/asmconfig1

# 分析当前的用户侧集群和ASM实例,模拟分析在应用了my-app-config目录中的配置文件后产生的效果,其中my-app-config目录中的所有配置文件都会被递归地分析。
asmctl analyze --recursive my-istio-config/

# 仅分析当前a.yaml、b.yaml与my-app-config目录中的YAML文件应用后的效果,而不考虑当前使用的用户侧集群和ASM实例的任何资源配置
asmctl analyze --use-kube=false a.yaml b.yaml my-app-config/

# 分析当前的用户侧集群和ASM实例,但对于testing命名空间下的mypod这一pod、忽略针对其产生的"PodMissingProxy"的分析结果输出。。
asmctl analyze -S "IST0103=Pod mypod.testing"

# 分析当前的用户侧集群和ASM实例,但对于testing命名空间下的所有Pod、忽略针对其产生的"PodMissingProxy"的分析结果输出。
# 同时对于default命名空间下的foobar这一deployment资源、忽略针对其产生的"MissplacedAnnotation"的分析结果输出。
asmctl analyze -S "IST0103=Pod *.testing" -S "IST0107=Deployment foobar.default"

# 列出当前asmctl analyze指令执行的所有分析手段。
asmctl analyze -L

asmctl bug-report

bug-report命令选择性地收集ASM实例与用户侧集群中的信息与日志,并压缩到一个压缩包,从而可以对常见问题进行诊断。收集的信息包括:

  • Sidecar的配置信息与状态信息。

  • Sidecar产生的日志信息。

  • 用户侧集群资源信息。

  • 调用analyze命令得出的分析结果。

asmctl bug-report [flags]

选项

选项缩写

描述

--asmconfig <string>

-m

ASM实例的kubeconfig文件路径,默认为$HOME/.kube/asmconfig

--context <string>

设置默认使用的kubeconfig context名称,默认为空。

--dir <string>

为bug-report命令中产生的临时输出文件设定一个目录,默认为空。

--dry-run

控制是否实际进行日志的收集和存储,设定dry-run选项,表示不进行实际的日志收集和存储。

--duration <duration>

从当前时间计算,往前收集多长一段时间的日志信息。默认为无穷大(0s),如果该项被设置,则start-time选项不能被设置。

--end-time <string>

要包含在命令输出中的日志的时间跨度的结束时间。默认为现在时间。

--exclude <stringSlice>

匹配应该从所有Sidecar日志中排除的容器组的Sidecar日志。该项在include选项之后生效,更多信息,请参见下文的自定义过滤bug-report命令收集的Sidecar日志。默认排除命名空间kube-system、kube-public、kube-node-lease、local-path-storage中的容器组。

--filename <string>

-f

指定一个包含bug-report配置信息的YAML文件。该文件中指定的选项内容将覆盖在命令行选项中指定的内容,默认为空。

--full-secrets

控制是否收集Secret信息,设定full-secrets选项,则收集Secret信息到命令输出中。

--ignore-errs <stringSlice>

一系列以逗号分隔的glob匹配模式,这些模式用来匹配忽略的日志错误(error)信息字符串。在计算日志重要性时,匹配该项给出模式的错误将忽略不计。

--include <stringSlice>

匹配应该在命令输出中包含的容器组的Sidecar日志,更多信息,请参见下文的自定义过滤bug-report命令收集的Sidecar日志。默认为空。

--istio-namespace <string>

-i

控制面组件安装的命名空间,默认为istio-system

--kubeconfig <string>

-c

设置用户侧集群的kubeconfig文件路径,默认为空。

--namespace <string>

-n

指定生效的命名空间,默认为空。

--start-time <string>

包含在命令输出中的日志的时间跨度的开始时间。默认为空,即从最早的日志开始收集。

--timeout <duration>

能够容忍获取日志所花的最长时间。当收集日志时间超时时,仅目前已经收集的日志会保存至命令输出,默认为30m0s

自定义过滤bug-report命令收集的Sidecar日志

Sidecar的日志收集可以通过以下的选项使用方式进行过滤:

--include|--exclude 
ns1,ns2.../dep1,dep2.../pod1,pod2.../cntr1,cntr.../lbl1=val1,lbl2=val2.../ann1=val1,ann2=val2

include/exclude选项后给出的字符串即为日志的过滤条件,其中ns指命名空间Namespace,dep指部署Deployment,pod指容器组Pod,cntr指容器Container,lbl指标签Label,ann指注解Annotation。

上述过滤条件表示必须匹配 (ns1 OR ns2) AND (dep1 OR dep2) AND (cntr1 OR cntr2)……,当且仅当一个容器组的Sidecar匹配至少一个include选项给出的过滤条件,并且不匹配所有exclude选项中给出的过滤条件时,其日志会被包含在最终命令输出的压缩包中。

所有的过滤条件都是可选的、可被忽略,例如可以使用ns1//pod1过滤条件,仅仅针对命名空间Namespace与容器组Pod进行过滤。

除标签label及注解annotation之外的所有类型的过滤名称都支持使用glob匹配模式,例如可以使用n*//p*/l=v*的过滤条件,该条件能够匹配所有在以n为开头的命名空间中,含有键名称为l的标签、而该标签对应的值以v开头,且自身名称以p开头的容器组。

asmctl dashboard

访问与社区istio兼容的Web UI。目前asmctl仅对Envoy提供了dashboard命令。

asmctl dashboard [flags]

您也可以使用:

asmctl dash [flags]
asmctl d [flags]

选项

选项缩写

描述

--address <string>

Web UI的监听地址,只接受IP地址或localhost。如果该项为localhost,asmctl将会尝试绑定127.0.0.1(IPV4)或是::1(IPV6)两个地址,如果这两个地址都无法绑定则命令执行失败。默认为localhost

--browser

设定是否打开浏览器。当browse选项被设定为false,asmctl将不会自动打开浏览器,默认为true

--context <string>

设置默认使用的kubeconfig context名称,默认为空。

--kubeconfig <string>

-c

设置用户侧集群的kubeconfig文件路径,默认为空。

--namespace <string>

-n

指定生效的命名空间,默认为空。

--port <int>

-p

Web UI监听的本地端口,默认为空。

asmctl dashboard envoy

为指定容器组的Sidecar打开Envoy管理面板。

asmctl dashboard envoy [<type>/]<name>[.<namespace>] [flags]

选项

选项缩写

描述

--address <string>

Web UI的监听地址,只接受IP地址或localhost。如果该项为localhost,asmctl将会尝试绑定127.0.0.1(IPV4)或是::1(IPV6)两个地址,如果这两个地址都无法绑定则命令执行失败。默认为localhost

--browser

设定是否打开浏览器。当browse选项被设定为false,asmctl将不会自动打开浏览器,默认为true

--context <string>

设置默认使用的kubeconfig context名称,默认为空。

--kubeconfig <string>

-c

设置用户侧集群的kubeconfig文件路径,默认为空。

--namespace <string>

-n

指定生效的命名空间,默认为空。

--port <int>

-p

Web UI监听的本地端口(默认为0)。

--selector <string>

-l

容器组标签选择器(默认为空,使用标签选择器时不能提供容器组名称。)

以下为asmctl dashboard envoy命令示例:

# 通过容器组名称和命名空间名称指定容器组,并打开Sidecar的Envoy管理面板。
asmctl dashboard envoy productpage-123-456.default

# 通过部署名称及容器组名称指定容器组,并打开Sidecar的Envoy管理面板。
asmctl dashboard envoy deployment/productpage-v1

# 使用Dashboard指令的缩写形式。
asmctl dash envoy productpage-123-456.default
asmctl d envoy productpage-123-456.default

asmctl experimental

asmctl experimental表示这些命令还在开发中,属于实验性命令。asmctl当前兼容社区Istioctl 1.9版本,与当前ASM和社区Istio的兼容性情况保持一致。因此,asmctl也保留与Istioctl 1.9版本形式一致的实验性命令。

选项

选项缩写

描述

--asmconfig <string>

-m

设置ASM实例的kubeconfig文件路径,默认为$HOME/.kube/asmconfig

--context <string>

设置默认使用的kubeconfig context名称,默认为空。

--istioNamespace <string>

-i

设置Istio所在命名空间名称,默认为istio-system

--kubeconfig <string>

-c

设置用户侧集群的kubeconfig文件路径,默认为空。

--namespace <string>

-n

指定生效的命名空间,默认为空。

asmctl experimental authz

authz系列命令提供与服务网格授权策略有关的功能。

选项

选项缩写

描述

--context <string>

设置默认使用的kubeconfig context名称,默认为空。

--istioNamespace <string>

-i

设置Istio所在命名空间名称,默认为istio-system

--kubeconfig <string>

-c

设置用户侧集群的kubeconfig文件路径,默认为空。

--namespace <string>

-n

指定生效的命名空间,默认为空。

asmctl experimental authz check

authz check命令检查指定容器组的Sidecar配置,并输出应用在该容器组Sidecar上的所有授权策略(AuthorizationPolicy)。该命令可用于方便地检查最终在多个授权策略合并后应用在某一具体Sidecar上的具体授权策略。

该命令同时支持使用-f选项来直接读取一个Sidecar配置的拷贝文件并输出该文件中配置规定的授权策略。

asmctl experimental authz check [<type>/]<name>[.<namespace>] [flags]

选项

选项缩写

描述

--context <string>

设置默认使用的kubeconfig context名称,默认为空。

--file <string>

-f

指定被检查的Envoy配置转储文件,文件为JSON格式,默认为空。

--istioNamespace <string>

-i

设置Istio所在命名空间名称,默认为istio-system

--kubeconfig <string>

-c

设置用户侧集群的kubeconfig文件路径,默认为空。

--namespace <string>

-n

指定生效的命名空间,默认为空。

以下为asmctl experimental authz check命令示例:

# 检查容器组httpbin-88ddbcfdd-nt5jb上应用的授权策略。
asmctl x authz check httpbin-88ddbcfdd-nt5jb

# 检查在部署productpage-v1上应用的授权策略。
asmctl proxy-status deployment/productpage-v1

# 从Envoy配置转储文件httpbin_config_dump.json中检查应用到的授权策略。
asmctl x authz check -f httpbin_config_dump.json

asmctl experimental config

config系列命令提供与服务网格默认设置有关的功能。

选项

选项缩写

描述

--context <string>

设置默认使用的kubeconfig context名称,默认为空。

--istioNamespace <string>

-i

设置Istio所在命名空间名称,默认为istio-system

--kubeconfig <string>

-c

设置用户侧集群的kubeconfig文件路径,默认为空。

asmctl experimental config list

config list命令列出服务网格中可配置的默认设置信息。

asmctl experimental config list [flags]

选项

选项缩写

描述

--context <string>

设置默认使用的kubeconfig context名称,默认为空。

--istioNamespace <string>

-i

设置Istio所在命名空间名称,默认为istio-system

--kubeconfig <string>

-c

设置用户侧集群的kubeconfig文件路径,默认为空。

--namespace <string>

-n

指定生效的命名空间,默认为空。

asmctl experimental describe

describe系列命令输出有关指定Kubernetes资源以及与其相关的服务网格配置的描述性信息。

asmctl experimental describe [command] [flags]

您也可以使用:

asmctl experimental des [command] [flags]

选项

选项缩写

描述

--asmconfig <string>

-m

ASM实例的kubeconfig文件路径,默认为$HOME/.kube/asmconfig

--context <string>

设置默认使用的kubeconfig context名称,默认为空。

--istioNamespace <string>

-i

设置Istio所在命名空间名称,默认为istio-system

--kubeconfig <string>

-c

设置用户侧集群的kubeconfig文件路径,默认为空。

--namespace <string>

-n

指定生效的命名空间,默认为空。

asmctl experimental describe pod

describe pod命令根据指定的容器组,分析与它相关的Kubernetes服务、目标规则和虚拟服务等,并最终输出与该容器组相关的描述性信息。

asmctl experimental describe pod <pod> [flags]

选项

选项缩写

描述

--context <string>

设置默认使用的kubeconfig context名称,默认为空。

--ignoreUnmeshed

对于分析时发现的未加入网格的容器组,设定是否输出警告信息,默认为false

--istioNamespace <string>

-i

设置Istio所在命名空间名称,默认为istio-system

--kubeconfig <string>

-c

设置用户侧集群的kubeconfig文件路径,默认为空。

--asmconfig <string>

-m

ASM实例的kubeconfig文件路径,默认为$HOME/.kube/asmconfig

--namespace <string>

-n

指定生效的命名空间,默认为空。

以下为asmctl experimental describe pod命令示例:

# 输出与容器组productpage-v1-c7765c886-7zzd4相关的描述性信息。
asmctl experimental describe pod productpage-v1-c7765c886-7zzd4

asmctl experimental describe service

describe service命令根据指定的Kubernetes服务,结合分析与它相关的容器组、目标规则和虚拟服务等,并最终输出与该Kubernetes服务相关的描述性信息。

asmctl experimental describe service <svc> [flags]

您也可以使用:

asmctl experimental describe svc <svc> [flags]

选项

选项缩写

描述

--context <string>

设置默认使用的kubeconfig context名称,默认为空。

--ignoreUnmeshed

对于分析时发现的未加入网格的容器组,设定是否输出警告信息,默认为false

--istioNamespace <string>

-i

设置Istio所在命名空间名称,默认为istio-system

--kubeconfig <string>

-c

设置用户侧集群的kubeconfig文件路径,默认为空。

--asmconfig <string>

-m

ASM实例的kubeconfig文件路径,默认为$HOME/.kube/asmconfig

--namespace <string>

-n

指定生效的命名空间,默认为空。

以下为asmctl experimental describe service命令示例:

# 输出Kubernetes服务productpage相关的描述性信息。
asmctl experimental describe service productpage

asmctl experimental injector

injector系列命令负责与Sidecar注入情况以及Sidecar注入器信息有关的功能。

asmctl experimental injector [command] [flags]

选项

选项缩写

描述

--context <string>

设置默认使用的kubeconfig context名称,默认为空。

--istioNamespace <string>

-i

设置Istio所在命名空间名称,默认为istio-system

--kubeconfig <string>

-c

设置用户侧集群的kubeconfig文件路径,默认为空。

--namespace <string>

-n

指定生效的命名空间,默认为空。

asmctl experimental injector list

injector list命令列出每个命名空间中容器组Sidecar的注入情况,并输出ASM使用的Sidecar注入器的概要信息。

asmctl experimental injector list [flags]

选项

选项缩写

描述

--context <string>

设置默认使用的kubeconfig context名称,默认为空。

--istioNamespace <string>

-i

设置Istio所在命名空间名称,默认为istio-system

--kubeconfig <string>

-c

设置用户侧集群的kubeconfig文件路径,默认为空。

--namespace <string>

-n

指定生效的命名空间,默认为空。

以下为asmctl experimental injector list命令示例:

# 列出每个命名空间中容器组Sidecar的注入情况,并输出ASM使用的Sidecar注入器的概要信息。
asmctl experimental injector list

asmctl proxy-config

proxy-config系列命令负责获取容器组中Sidecar的配置信息。

选项

选项缩写

描述

--context <string>

设置默认使用的kubeconfig context名称,默认为空。

--istioNamespace <string>

-i

设置Istio所在命名空间名称,默认为istio-system

--kubeconfig <string>

-c

设置用户侧集群的kubeconfig文件路径,默认为空。

--namespace <string>

-n

指定生效的命名空间,默认为空。

--output <string>

-o

设置命令输出格式,可选jsonshort,默认为short

asmctl proxy-config bootstrap

proxy-config bootstrap命令负责获取指定容器组中Sidecar Envoy的bootstrap配置信息。

asmctl proxy-config bootstrap [<type>/]<name>[.<namespace>] [flags]

您也可以使用:

asmctl proxy-config b [<type>/]<name>[.<namespace>] [flags]

选项

选项缩写

描述

--context <string>

设置默认使用的kubeconfig context名称,默认为空。

--file <string>

-f

Envoy配置转储文件,JSON格式,默认为空。

--istioNamespace <string>

-i

设置Istio所在命名空间名称,默认为istio-system

--kubeconfig <string>

-c

设置用户侧集群的kubeconfig文件路径,默认为空。

--namespace <string>

-n

指定生效的命名空间,默认为空。

--output <string>

-o

设置命令输出格式,可选jsonshort,默认为short

以下为asmctl proxy-config bootstrap命令示例:

# 从指定的容器组中获取Sidecar Envoy的bootstrap配置信息。
asmctl proxy-config bootstrap <pod-name[.namespace]>

# 不使用Kubernetes API,直接从文件中分析得到Sidecar Envoy bootstrap配置信息。
ssh <user@hostname> 'curl localhost:15000/config_dump' > envoy-config.json
asmctl proxy-config bootstrap --file envoy-config.json

asmctl proxy-config cluster

proxy-config cluster命令负责获取指定容器组中Sidecar Envoy的集群配置信息。

asmctl proxy-config cluster [<type>/]<name>[.<namespace>] [flags]

您也可以使用:

asmctl proxy-config clusters [<type>/]<name>[.<namespace>] [flags]
asmctl proxy-config c [<type>/]<name>[.<namespace>] [flags]

选项

选项缩写

描述

--context <string>

设置默认使用的kubeconfig context名称,默认为空。

--direction <string>

通过Direction字段筛选收集的cluster配置信息,默认为空。

--file <string>

-f

Envoy配置转储文件,JSON格式,默认为空。

--fqdn <string>

通过Service FQDN字段筛选收集的cluster配置信息,默认为空。

--istioNamespace <string>

-i

设置Istio所在命名空间名称,默认为istio-system

--kubeconfig <string>

-c

设置用户侧集群的kubeconfig文件路径,默认为空。

--namespace <string>

-n

指定生效的命名空间,默认为空。

--output <string>

-o

设置命令输出格式,可选jsonshort,默认为short

--port <int>

通过Port字段筛选收集的cluster配置信息,默认为空。

--subset <string>

通过Subset字段筛选收集的cluster配置信息,默认为空。

以下为asmctl proxy-config cluster命令示例:

# 从指定的容器组中获取Sidecar Envoy的cluster配置信息。
asmctl proxy-config clusters <pod-name[.namespace]>

# 从指定的容器组中获取Sidecar Envoy的cluster配置信息,筛选端口为9080的部分输出。
asmctl proxy-config clusters <pod-name[.namespace]> --port 9080

# 获取FQDN为details.default.svc.cluster.local的入站集群的完整转储。
asmctl proxy-config clusters <pod-name[.namespace]> --fqdn details.default.svc.cluster.local --direction inbound -o json

# 不使用Kubernetes API,仅使用文件获取cluster配置信息。
ssh <user@hostname> 'curl localhost:15000/config_dump' > envoy-config.json
asmctl proxy-config clusters --file envoy-config.json

asmctl proxy-config endpoint

proxy-config endpoint命令负责获取指定容器组中Sidecar Envoy的Endpoint配置信息。

asmctl proxy-config endpoint [<type>/]<name>[.<namespace>] [flags]

您也可以使用:

asmctl proxy-config endpoints [<type>/]<name>[.<namespace>] [flags]
asmctl proxy-config ep [<type>/]<name>[.<namespace>] [flags]

选项

选项缩写

描述

--address <string>

通过address字段筛选收集的Endpoint配置信息,默认为空。

--cluster <string>

通过cluster name字段筛选收集的Endpoint配置信息,默认为空。

--context <string>

设置默认使用的kubeconfig context名称,默认为空。

--file <string>

-f

Envoy配置转储文件,JSON格式,默认为空。

--istioNamespace <string>

-i

设置Istio所在命名空间名称,默认为istio-system

--kubeconfig <string>

-c

设置用户侧集群的kubeconfig文件路径,默认为空。

--namespace <string>

-n

指定生效的命名空间,默认为空。

--output <string>

-o

命令输出格式,可选jsonshort,默认为short

--port <int>

通过Port字段筛选收集的Endpoint配置信息,默认为空。

--status <string>

通过status字段筛选收集的Endpoint配置信息,默认为空。

以下为asmctl proxy-config endpoint命令示例:

# 从指定的容器组中获取Sidecar Envoy的Endpoint配置信息。
asmctl proxy-config endpoint <pod-name[.namespace]>

# 从指定的容器组中获取Sidecar Envoy的Endpoint配置信息,筛选其中端口为9080的部分。
asmctl proxy-config endpoint <pod-name[.namespace]> --port 9080

# 从指定的容器组中获取Sidecar Envoy的Endpoint配置信息,筛选其中地址为172.17.0.2的部分。
asmctl proxy-config endpoint <pod-name[.namespace]> --address 172.17.0.2 -o json

# 从指定的容器组中获取Sidecar Envoy的Endpoint配置信息,筛选集群名称为outbound|9411||zipkin.istio-system.svc.cluster.local的部分。
asmctl proxy-config endpoint <pod-name[.namespace]> --cluster "outbound|9411||zipkin.istio-system.svc.cluster.local" -o json
# 从指定的容器组中获取Sidecar Envoy的Endpoint配置信息,筛选其中状态为healthy的部分。
asmctl proxy-config endpoint <pod-name[.namespace]> --status healthy -ojson

# 不使用Kubernetes API,仅使用文件获取Endpoint配置信息。
ssh <user@hostname> 'curl localhost:15000/clusters?format=json' > envoy-clusters.json
asmctl proxy-config endpoints --file envoy-clusters.json

asmctl proxy-config listener

proxy-config listener命令负责获取指定容器组中Sidecar Envoy的Listener配置信息。

asmctl proxy-config listener [<type>/]<name>[.<namespace>] [flags]

您也可以使用:

asmctl proxy-config listeners [<type>/]<name>[.<namespace>] [flags]
asmctl proxy-config l [<type>/]<name>[.<namespace>] [flags]

选项

选项缩写

描述

--address <string>

通过address字段筛选收集的Listener配置信息,默认为空。

--context <string>

设置默认使用的kubeconfig context名称,默认为空。

--file <string>

-f

Envoy配置转储文件,JSON格式,默认为空。

--istioNamespace <string>

-i

设置Istio所在命名空间名称,默认为istio-system

--kubeconfig <string>

-c

设置用户侧集群的kubeconfig文件路径,默认为空。

--namespace <string>

-n

指定生效的命名空间,默认为空。

--output <string>

-o

命令输出格式,可选jsonshort,默认为short

--port <int>

通过Port字段筛选收集的Listener配置信息,默认为空。

--type <string>

通过type字段筛选收集的Listener配置信息,默认为空。

--verbose

输出更多信息,默认为true

以下为asmctl proxy-config listener命令示例:

# 从指定的容器组中获取Sidecar Envoy的Listener配置信息。
asmctl proxy-config listeners <pod-name[.namespace]>

# 从指定的容器组中获取Sidecar Envoy的Listener配置信息,筛选其中端口为9080的部分。
asmctl proxy-config listeners <pod-name[.namespace]> --port 9080

# 使用通配符地址0.0.0.0 从指定的容器组中获取Sidecar Envoy的Listenerr配置信息。
asmctl proxy-config listeners <pod-name[.namespace]> --type HTTP --address 0.0.0.0 -o json

# 不使用Kubernetes API,仅使用文件获取Listener配置信息。
ssh <user@hostname> 'curl localhost:15000/config_dump' > envoy-config.json
asmctl proxy-config listeners --file envoy-config.json

asmctl proxy-config log

proxy-config log命令负责获取Sidecar Envoy的日志等级信息,并且也可以选择性地更新日志等级信息。

asmctl proxy-config log [<type>/]<name>[.<namespace>] [flags]

您也可以使用:

asmctl proxy-config o [<type>/]<name>[.<namespace>] [flags]

选项

选项缩写

描述

--context <string>

设置默认使用的kubeconfig context名称,默认为空。

--istioNamespace <string>

-i

设置Istio所在命名空间名称,默认为istio-system

--kubeconfig <string>

-c

设置用户侧集群的kubeconfig文件路径,默认为空。

--level <string>

要输出的以逗号分隔的每个logger的最低消息级别,形式为:[<logger>:]<level>,[<logger>:]<level>,...。其中,logger可以是adminawsassertbacktraceclientconfigconnectionconn_handlerdubbofilefilterforward_proxygrpchchealth_checkerhttpmongoquicpoolrbacredisrouterruntimestatssecrettaptestingthrifttracingupstreamudpwasm中的一个。而消息级别可以是tracedebuginfowarningerrorcriticaloff中的一个,默认为空。

--namespace <string>

-n

指定生效的命名空间,默认为空。

--output <string>

-o

设置命令输出格式,可选jsonshort,默认为short

--reset

-r

将日志等级重设为默认值(warning)。

--selector <string>

-l

标签选择器,默认为空。

以下为asmctl proxy-config log命令示例:

# 从指定的容器组中获取Sidecar Envoy的日志等级信息。
asmctl proxy-config log <pod-name[.namespace]>

# 更新Sidecar Envoy中所有logger的日志消息等级。
asmctl proxy-config log <pod-name[.namespace]> --level none

# 为Sidecar Envoy中指定的logger的日志消息等级进行更新。
asmctl proxy-config log <pod-name[.namespace]> --level http:debug,redis:debug

# 将Sidecar Envoy中所有logger的日志消息等级重设为默认值warning。
asmctl proxy-config log <pod-name[.namespace]> -r

asmctl proxy-config route

proxy-config route命令负责获取指定容器组中Sidecar Envoy的Route配置信息。

asmctl proxy-config route [<type>/]<name>[.<namespace>] [flags]

您也可以使用:

asmctl proxy-config routes [<type>/]<name>[.<namespace>] [flags]
asmctl proxy-config r [<type>/]<name>[.<namespace>] [flags]

选项

选项缩写

描述

--context <string>

设置默认使用的kubeconfig context名称,默认为空。

--file <string>

-f

Envoy配置转储文件,JSON格式,默认为空。

--istioNamespace <string>

-i

设置Istio所在命名空间名称,默认为istio-system

--kubeconfig <string>

-c

设置用户侧集群的kubeconfig文件路径,默认为空。

--name <string>

通过name字段筛选收集的Router配置信息,默认为空。

--namespace <string>

-n

指定生效的命名空间,默认为空。

--output <string>

-o

设置命令输出格式,可选jsonshort,默认为short

--verbose

输出更多信息,默认为true

以下为asmctl proxy-config route命令示例:

# 从指定的容器组中获取Sidecar Envoy的Route配置信息。
asmctl proxy-config routes <pod-name[.namespace]>

# 获取指定Sidecar Envoy的route 9080的配置信息。
asmctl proxy-config route <pod-name[.namespace]> --port 9080

# 获取指定Sidecar Envoy的route 9080的配置信息并获得完整转储。
asmctl proxy-config route <pod-name[.namespace]> --name 9080 -o json

# 不使用Kubernetes API,仅使用文件获取Route配置信息。
ssh <user@hostname> 'curl localhost:15000/config_dump' > envoy-config.json
asmctl proxy-config listeners --file envoy-config.json

asmctl proxy-config secret

proxy-config secret命令负责获取指定容器组中Sidecar Envoy的Secret配置信息。

asmctl proxy-config secret [<type>/]<name>[.<namespace>] [flags]

也可以使用:

asmctl proxy-config secrets [<type>/]<name>[.<namespace>] [flags]
asmctl proxy-config s [<type>/]<name>[.<namespace>] [flags]

选项

选项缩写

描述

--context <string>

设置默认使用的kubeconfig context名称,默认为空。

--file <string>

-f

Envoy配置转储文件,JSON格式,默认为空。

--istioNamespace <string>

-i

设置Istio所在命名空间名称,默认为istio-system

--kubeconfig <string>

-c

设置用户侧集群的kubeconfig文件路径,默认为空。

--namespace <string>

-n

指定生效的命名空间,默认为空。

--output <string>

-o

设置命令输出格式,可选jsonshort,默认为short

以下为asmctl proxy-config secret命令示例:

# 从指定的容器组中获取Sidecar Envoy的Secret配置信息。
asmctl proxy-config secret <pod-name[.namespace]>

# 不使用Kubernetes API,仅使用文件获取Secret配置信息。
ssh <user@hostname> 'curl localhost:15000/config_dump' > envoy-config.json
asmctl proxy-config listeners --file envoy-config.json

asmctl validate

validate命令负责验证服务网格规则与策略文件的正确性。

asmctl validate -f FILENAME [options] [flags]

您也可以使用:

asmctl v -f FILENAME [options] [flags]

选项

选项缩写

描述

--context <string>

设置默认使用的kubeconfig context名称,默认为空。

--file <string>

-f

需要验证的服务网格规格与策略文件名称。

--istioNamespace <string>

-i

设置Istio所在命名空间名称,默认为istio-system

--namespace <string>

-n

指定生效的命名空间,默认为空。

以下为asmctl validate命令示例:

# 验证bookinfo-gateway.yaml的正确性。
asmctl validate -f samples/bookinfo/networking/bookinfo-gateway.yaml

# 使用缩短的语法验证bookinfo-gateway.yaml的正确性。
asmctl v -f samples/bookinfo/networking/bookinfo-gateway.yaml

# 验证当前default命名空间下所有部署的正确性。
asmctl get deployments -o yaml | asmctl validate -f -

# 验证当前default命名空间下所有服务的正确性。
asmctl get services -o yaml | asmctl validate -f -
  • 本页导读 (1)
文档反馈