-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
389c5df
commit 37ccd77
Showing
1 changed file
with
112 additions
and
0 deletions.
There are no files selected for viewing
112 changes: 112 additions & 0 deletions
112
_posts/development/istio/2024-03-24-istioctl-debug-tool.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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์ ์ํ์ ์ ํจ๊ธฐ๊ฐ์ ์ ์ ์๋ค. |