ENVOY-ISTIO39 cmd
Envoy / Istio チート集
Envoy admin API、listener/route/cluster、HTTP filter、Istio の VirtualService、DestinationRule、Gateway、mTLS、proxy-config デバッグを整理したチート集。
- 更新日
- 2026-05-14
- 参照範囲
- 公式ドキュメント / man page / 主要ベンダーCLI
- 対象実装
- 主要 Linux / BSD / ネットワーク機器 CLI の一般的な実装
- 免責
- OS とバージョン差分は実環境で確認してください。
39 / 39
| Command | Description | Example | Copy |
|---|---|---|---|
/clusters | Envoy admin API で cluster 状態を確認する。 | curl -s http://127.0.0.1:9901/clusters | head -40 | |
/config_dump | 現在の xDS/静的設定を JSON で取得する。 | curl -s http://127.0.0.1:9901/config_dump | jq .configs[0] | |
/stats | 全メトリクスを表示する。 | curl -s http://127.0.0.1:9901/stats | grep upstream_rq_5xx | |
/logging | ログレベル一覧を表示する。 | curl -s http://127.0.0.1:9901/logging | |
/logging?level=debug | 全体ログレベルを debug に変更する。 | curl -X POST "http://127.0.0.1:9901/logging?level=debug" | |
/ready | Envoy の readiness を確認する。 | curl -i http://127.0.0.1:9901/ready | |
listener yaml | HTTP listener の最小構造。 | static_resources:
listeners:
- name: listener_0
address:
socket_address: { address: 0.0.0.0, port_value: 10000 } | |
virtual_host route | Host と prefix で route を定義する。 | virtual_hosts:
- name: backend
domains: ["example.com"]
routes:
- match: { prefix: "/api" }
route: { cluster: api_cluster } | |
cluster strict_dns | DNS 解決する upstream cluster を定義する。 | clusters:
- name: api_cluster
type: STRICT_DNS
connect_timeout: 2s
load_assignment:
cluster_name: api_cluster | |
cluster logical_dns | 単一 DNS 名を論理 host として扱う。 | clusters:
- name: ext_api
type: LOGICAL_DNS
dns_lookup_family: V4_ONLY
load_assignment: { cluster_name: ext_api } | |
route timeout | route 単位の timeout を指定する。 | route:
cluster: api_cluster
timeout: 3s | |
retry_policy | 5xx と connect-failure を再試行する。 | retry_policy:
retry_on: 5xx,connect-failure
num_retries: 2
per_try_timeout: 1s | |
router filter | HTTP ルーティングの終端 filter。 | - name: envoy.filters.http.router
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router | |
fault filter | 遅延やエラーを注入する。 | - name: envoy.filters.http.fault
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.fault.v3.HTTPFault
delay: { fixed_delay: 2s, percentage: { numerator: 10 } } | |
cors filter | CORS レスポンスを制御する。 | - name: envoy.filters.http.cors
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.cors.v3.Cors | |
rate_limit filter | 外部 rate limit service と連携する。 | - name: envoy.filters.http.ratelimit
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.ratelimit.v3.RateLimit
domain: edge | |
ext_authz filter | 外部認可サービスへ問い合わせる。 | - name: envoy.filters.http.ext_authz
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.ext_authz.v3.ExtAuthz
grpc_service: { envoy_grpc: { cluster_name: authz } } | |
lua filter | Lua でヘッダを付与する。 | - name: envoy.filters.http.lua
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.lua.v3.Lua
inline_code: "function envoy_on_response(h) h:headers():add("x-envoy","ok") end" | |
istioctl analyze | Istio 設定の静的解析を行う。 | istioctl analyze -A | |
istioctl proxy-status | Envoy と control plane の同期状態を確認する。 | istioctl proxy-status | |
istioctl proxy-config clusters | Pod の cluster 設定を確認する。 | istioctl proxy-config clusters deploy/web -n prod | |
istioctl pc routes -o json | route 設定を JSON で確認する。 | istioctl pc routes deploy/web -n prod -o json | jq .[0].virtualHosts[0].routes[0] | |
istioctl pc listeners | listener 設定を確認する。 | istioctl pc listeners pod/web-6c9d9f -n prod | |
VirtualService minimal | HTTP route の最小例。 | apiVersion: networking.istio.io/v1
kind: VirtualService
metadata: { name: web }
spec:
hosts: ["web.example.com"]
http:
- route:
- destination: { host: web.prod.svc.cluster.local, port: { number: 80 } } | |
DestinationRule subset | subset と trafficPolicy を定義する。 | apiVersion: networking.istio.io/v1
kind: DestinationRule
metadata: { name: web }
spec:
host: web.prod.svc.cluster.local
subsets:
- name: v1
labels: { version: v1 } | |
Gateway minimal | Ingress Gateway の待受を定義する。 | apiVersion: networking.istio.io/v1
kind: Gateway
metadata: { name: web-gw }
spec:
selector: { istio: ingressgateway }
servers:
- port: { number: 80, name: http, protocol: HTTP }
hosts: ["web.example.com"] | |
PeerAuthentication STRICT | namespace 単位で mTLS を必須にする。 | apiVersion: security.istio.io/v1
kind: PeerAuthentication
metadata: { name: default, namespace: prod }
spec:
mtls: { mode: STRICT } | |
AuthorizationPolicy allow | 特定 service account だけ許可する。 | apiVersion: security.istio.io/v1
kind: AuthorizationPolicy
metadata: { name: allow-frontend, namespace: prod }
spec:
selector: { matchLabels: { app: web } }
rules:
- from:
- source: { principals: ["cluster.local/ns/prod/sa/frontend"] } | |
namespace injection label | サイドカー自動注入を有効化する。 | kubectl label namespace prod istio-injection=enabled --overwrite | |
check sidecar injection | Pod に istio-proxy が入ったか確認する。 | kubectl get pod -n prod web-6c9d9f -o jsonpath="{.spec.containers[*].name}" | |
mTLS mode check | 認証設定と証明書状態を確認する。 | istioctl authn tls-check web.prod.svc.cluster.local | |
proxy log level | 特定 proxy のログレベルを変更する。 | istioctl proxy-config log deploy/web -n prod --level http:debug,router:debug | |
envoy tap | Istio proxy で HTTP tap を開始する。 | istioctl experimental proxy-config tap deploy/web -n prod --http-path /api | |
kubectl logs istio-proxy | sidecar のログを確認する。 | kubectl logs deploy/web -n prod -c istio-proxy --tail=100 | |
pilot-agent request | Pod 内から admin API を叩く。 | kubectl exec -n prod deploy/web -c istio-proxy -- pilot-agent request GET stats | |
istioctl x describe | Service/Pod 観点で設定衝突を確認する。 | istioctl experimental describe pod web-6c9d9f -n prod | |
config dump diff | 問題 Pod と正常 Pod の設定差分を取る。 | istioctl pc all pod/web-a -n prod -o json > /tmp/a.json
istioctl pc all pod/web-b -n prod -o json > /tmp/b.json
diff -u /tmp/a.json /tmp/b.json | |
proxy-status stale | 同期不良 proxy を抽出する。 | istioctl proxy-status | awk '$3 != "SYNCED" || $4 != "SYNCED" {print}' | |
istioctl version | client/control plane/data plane のバージョンを確認する。 | istioctl version --remote=false |