Skip to content

Commit

Permalink
istioctl debug tool
Browse files Browse the repository at this point in the history
  • Loading branch information
BlueHorn07 committed Mar 24, 2024
1 parent 389c5df commit 37ccd77
Showing 1 changed file with 112 additions and 0 deletions.
112 changes: 112 additions & 0 deletions _posts/development/istio/2024-03-24-istioctl-debug-tool.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
---
title: "istioctl ๋””๋ฒ„๊ทธ ๋„๊ตฌ๋“ค"
toc: true
toc_sticky: true
categories: ["Kubernetes", "Istio"]
excerpt: "์•Œ์•„๋‘๋ฉด ๋„์›€์ด ๋˜๋Š” istioctl analyze, describe, proxy-status, proxy-config ๐Ÿ› ๏ธ"
last_modified_at: 2024-03-24
---


# `istioctl analyze`

์ƒ์„ฑํ•œ Istio ๋ฆฌ์†Œ์Šค๋“ค(`VirtuslService`, `DestinationRule`) ๋“ฑ์ด ๋ฌธ์ œ๊ฐ€ ์—†๋Š”์ง€ ํ™•์ธํ•˜๋Š” ์šฉ๋„์˜ ๋ช…๋ น์–ด.

```bash
$ istioctl analyze -A
Info [IST0102] (Namespace haha) The namespace is not enabled for Istio injection. Run 'kubectl label namespace haha istio-injection=enabled' to enable it, or 'kubectl label namespace haha istio-injection=disabled' to explicitly mark it as not needing injection.
Info [IST0102] (Namespace prod) The namespace is not enabled for Istio injection. Run 'kubectl label namespace prod istio-injection=enabled' to enable it, or 'kubectl label namespace prod istio-injection=disabled' to explicitly mark it as not needing injection.
Info [IST0118] (Service istio-system/jaeger-collector) Port name jaeger-collector-grpc (port: 14250, targetPort: 14250) doesn't follow the naming convention of Istio port.
Info [IST0118] (Service istio-system/jaeger-collector) Port name jaeger-collector-http (port: 14268, targetPort: 14268) doesn't follow the naming convention of Istio port.
```

ํด๋Ÿฌ์Šคํ„ฐ์— ์กด์žฌํ•˜๋Š” ๋„ค์ž„์ŠคํŽ˜์ด์Šค ์ค‘์— `istio-injection` ๋ ˆ์ด๋ธ”์ด ์—†๋Š” ๊ฒƒ๋“ค๋„ ์•Œ๋ ค์ฃผ๊ณ , ์–ด๋–ค ๋‘ ๋ฆฌ์†Œ์Šค๊ฐ€ `hosts` ์˜์—ญ์ด ๊ฒน์นœ๋‹ค๊ฑฐ๋‚˜ ํ•˜๋Š” ๊ฒƒ๋“ค์„ ์•Œ๋ ค์คŒ.

์‹ค์ˆ˜ ํ•œ๊ฒŒ ์—†๋Š”์ง€ ํ™•์ธํ•˜๋Š” ๊ฐ€์žฅ ๊ฐ„๋‹จํ•œ ๋ฐฉ๋ฒ•!

# `istioctl x describe`

K8s Pod์ด๋‚˜ Service์˜ ์ƒํƒœ๋ฅผ ํ™•์ธํ•˜๋Š” ์šฉ๋„์˜ ๋ช…๋ น์–ด.

## `istioctl x describe pod <pod-name>`

```bash
$ istioctl x describe pod productpage-v1-xxxx-xxxx
Pod: productpage-v1-xxxx-xxxx
Pod Revision: default
Pod Ports: 9080 (productpage), 15090 (istio-proxy)
--------------------
Service: productpage
Port: http 9080/HTTP targets pod port 9080
--------------------
Effective PeerAuthentication:
Workload mTLS mode: STRICT
Applied PeerAuthentication:
default.istio-system

Exposed on Ingress Gateway http://192.168.64.2
VirtualService: bookinfo
Match: /productpage, Match: /static*, Match: /login, Match: /logout, Match: /api/v1/products*
```

## `istioctl x describe svc <svc-name>`

```bash
$ istioctl x describe svc productpage
Service: productpage
Port: http 9080/HTTP targets pod port 9080

Exposed on Ingress Gateway http://192.168.64.2
VirtualService: bookinfo
Match: /productpage, Match: /static*, Match: /login, Match: /logout, Match: /api/v1/products*
```

K8s Pod๊ณผ Service๊ฐ€ ํ˜„์žฌ ์–ด๋–ค `VirtualService`, `DestinationRule`์˜ ๊ทœ์น™์„ ์ ์šฉ ๋ฐ›๊ณ  ์žˆ๋Š”์ง€ ํŒŒ์•… ๊ฐ€๋Šฅ.

# `istioctl proxy-status`

Envoy Proxy์˜ ํ˜„์žฌ ์ƒํƒœ๋ฅผ ํ™•์ธํ•˜๋Š” ๋ช…๋ น์–ด. Envoy xDS์™€ ๊ด€๋ จ๋œ ๋ถ€๋ถ„์ธ๋ฐ, ํ˜„์žฅ์—์„  ์ž˜ ์•ˆ ์“ฐ๋Š” ๋“ฏ?

```bash
istioctl proxy-status
NAME CLUSTER CDS LDS EDS RDS ECDS ISTIOD VERSION
details-v1-7745b6fcf4-gmp5l.default Kubernetes SYNCED SYNCED SYNCED SYNCED NOT SENT istiod-6b4c7d75b7-4h5f9 1.20.3
fortio.default Kubernetes SYNCED SYNCED SYNCED SYNCED NOT SENT istiod-6b4c7d75b7-4h5f9 1.20.3
helloworld-v1-6b887df7b7-mx57q.default Kubernetes SYNCED SYNCED SYNCED SYNCED NOT SENT istiod-6b4c7d75b7-4h5f9 1.20.3
helloworld-v1-77489ccb5f-tbrpr.test Kubernetes SYNCED SYNCED SYNCED SYNCED NOT SENT istiod-6b4c7d75b7-4h5f9 1.20.3
httpbin-v1-7b56f9959b-b5grp.default Kubernetes SYNCED SYNCED SYNCED SYNCED NOT SENT istiod-6b4c7d75b7-4h5f9 1.20.3
httpbin-v2-65b8495dfd-t8mx2.default Kubernetes SYNCED SYNCED SYNCED SYNCED NOT SENT istiod-6b4c7d75b7-4h5f9 1.20.3
```

์˜ˆ๋ฅผ ๋“ค์–ด, [`IstioOperator`์˜ Canary Upgrade](https://bluehorn07.github.io/2024/03/21/istio-revision-and-canary-upgrade/) ๋•Œ๋ฌธ์— ์„œ๋กœ ๋‹ค๋ฅธ `revision`์˜ istio๋ฅผ ์šด์˜ํ•ด๋Š” ์ƒํ™ฉ์ด๋ผ, ์–ด๋–ค ๊ฒƒ๋“ค์ด ๊ธฐ์กด istiod๋ฅผ ์“ฐ๊ณ  ์–ด๋–ค ๊ฒƒ๋“ค์ด `revision=canary`์˜ istiod๋ฅผ ์“ฐ๋Š”์ง€ ํ™•์ธํ•ด์•ผ ํ•œ๋‹ค๋ฉด ์œ ์šฉํ•  ๋“ฏ.

![](/images/development/istio/istio-canary-revision.png)

์š”๋ ‡๊ฒŒ ๋ง์ด๋‹ค.

# `istioctl proxy-config`

Envoy Proxy์˜ ๊ตฌ์„ฑ(config) ๊ด€๋ จ ์ •๋ณด๋ฅผ ์‚ดํŽด๋ณด๋Š” ๋ช…๋ น์–ด๋‹ค.

๊ฐ€๋Šฅํ•œ ๋Œ€์ƒ์€

```bash
all Retrieves all configuration for the Envoy in the specified pod
bootstrap Retrieves bootstrap configuration for the Envoy in the specified pod
cluster Retrieves cluster configuration for the Envoy in the specified pod
ecds Retrieves typed extension configuration for the Envoy in the specified pod
endpoint Retrieves endpoint configuration for the Envoy in the specified pod
listener Retrieves listener configuration for the Envoy in the specified pod
log Retrieves logging levels of the Envoy in the specified pod
rootca-compare Compare ROOTCA values for the two given pods
route Retrieves route configuration for the Envoy in the specified pod
secret Retrieves secret configuration for the Envoy in the specified pod
```
istio ๊ณต๋ถ€ํ•˜๋ฉด์„œ ์•„๋ž˜ ์ผ€์ด์Šค ๋นผ๊ณ ๋Š” ์จ๋ณธ ์ ์ด ์—†๋Š” ๋“ฏ ใ…‡ใ……ใ…‡
## `isitoctl proxy-config secret <pod-name>`
![](/images/development/istio/istioctl-proxy-config-ca-cert.png)
Envoy Proxy๊ฐ€ ๊ฐ€์ง„ CA Cert์˜ ์ƒํƒœ์™€ ์œ ํšจ๊ธฐ๊ฐ„์„ ์•Œ ์ˆ˜ ์žˆ๋‹ค.

0 comments on commit 37ccd77

Please sign in to comment.