istioctl 中的一些小工具

引子

许久不见, istioctl
中加入了不少有趣的新命令。装备党自然是喜欢小工具了,选几个有趣的命令分享给大家。

Analyze

Istio 的配置是比较繁杂的,相信玩过的朋友都比较有体会,

istioctl x analyze
,可以对 Istio 进行一些检查,
目前该工具支持的检测范围包括:

  • IST0001:
    内部错误,基本上是属于实现部分的 Bug。
  • IST0002:
    对象中存在过期特性。
  • IST0101:
    应用对象不存在,例如有 VirtualService 无 Workload。
  • IST0102:
    命名空间未开启自动注入。
  • IST0103:
    有 Pod 没有注入 Istio Proxy。
  • IST0104:
    网关端口没有工作负载。
  • IST0105:
    Sidecar 版本和 Istio 版本不一致。
  • IST0106:
    文件格式错误。
  • IST0107:
    注解目标错误。
  • IST0108:
    未知注解。
  • IST0109:
    网关内 VirtualService 主机名冲突。
  • IST0110:
    Sidecar 对象选择器重叠。
  • IST0111:
    多于一个 Sidecar 对象没有负载选择器。
  • IST0112:
    多端口服务的 VirtualService 缺乏选择。

例如:

$ istioctl x analyze -k
Warn [IST0103] (Pod httpbin-7d9d5b55b9-jslpp.default) The pod is missing its Istio proxy. Run 'kubectl delete pod httpbin-
7d9d5b55b9-jslpp -n default' to restart it
Error: Analyzer found issues.

Dashboard

可能是向 Linkerd 致敬?
打开 Istio 的各种仪表盘页面:

  • controlz:

    打开指定控制平面组件的
    ctrlz
    界面。

  • envoy:
    打开特定 Pod 的 Envoy 仪表盘
  • grafana:
    缺省 Grafana 页面
  • jaeger、kiali、zipkin 和 Prometheus 页面

Metrics

查看指定服务的性能指标:

  • 总体 RPS
  • 错误 RPS
  • P50 延迟
  • P90 延迟
  • P99 延迟

Manifest

用于生成或安装 Istio 清单,例如推荐的安装方式: istioctl manifest apply --set profile=demo

Profile

几个内置的安装配置,用于 Manifest 命令的 set profile
,其中包含:

  • minimal
  • remote
  • sds
  • default
  • demo

Describe

根据 Pod 和 Service,获取相关的配置内容,例如:

$ istioctl x describe service httpbin
Service: httpbin
   Port: http 8000/HTTP targets pod port 80
Pod is PERMISSIVE, client protocol unspecified
VirtualService: httpbin
   1 HTTP route(s)