# kubernetes-Istio구성정보
[![image.png](http://igoni.kr/uploads/images/gallery/2025-06/scaled-1680-/lMPimage.png)](http://igoni.kr/uploads/images/gallery/2025-06/lMPimage.png)
perplexity에서 생성한 AI이미지
## Istio Concept & Data Flow 1. Istio의 전체 Concept & Data Flow ![https://miro.medium.com/max/1600/0*mb8zxtJqtP7MKedD](https://miro.medium.com/max/1600/0*mb8zxtJqtP7MKedD) 2. Concept 1. ServiceMesh를 이용해 다양한 트래픽을 제어하는 역활 2. http / websocket / http 등 트래픽 제어/관리에 대한 부하분산 수행 3. Component별 역활 1. Data Plane - Service A / B에 구성된 Pod에는 Proxy용 Envoy Sidecar container가 배포 2. Control Plane - Mixer - 정책 설정 / ACL / 인증 역활 - Pilot : ingress routing, traffic mirroring, traffic shifting, canary deployments, circuit breaking, fault injection 역활 수행 - Galley : yaml을 istio용으로 변환 후 pilot으로 전송하고. - Citadel : 데이터 전송시 암호화 전송(TLS) 역활, 현재 내부 통신에는 암호화과정이 없어서 사용하지 않음 4. 구성시 유의사항 - istio기반의 traffic shaping을 적용하려면, k8s에서 사용하는 ingres(or service nodeport)를 사용하면 적용이 안되고 service는 clusterip로 적용하고, istio ingressgateway에서 port를 정의해주어야 함. *Servicemesh : MSA기반의 아키텍텨는 각각 개별기능을 수행하는데, 분산 서비스 배포의 크기와 복잡성이 증가하면서 시스템을 이해하고 관리하기 더 어려워지짐. 클러스터 내부와 외부의 통신 라우팅도 복잡해지기 때문에 이러한 복잡성을 줄기기 위해 프록시를 사용하여 모든 트래픽을 확인 후 사용자가 설정한 구성에 따라 어플리케이션 트래픽을 관리하는 역활.*
### Istio 설치 절차 1. 설치 ```shell $ curl -L https://istio.io/downloadIstio | sh - $ cd istio-1.9.2 $ ./istioctl install --set profile=default This will install the Istio 1.9.2  profile with ["Istio core"gateways"] components into the cluster. Proceed? (y/N) y ✔ Istio core installed ✔ Istiod installed ✔ Ingress gateways installed ✔ Installation complete ```
\# Istio기반의 proxy를 설치하기 위해서 namespace에 istio용 envoy 설치 $ kubectl label namespace default istio-injection=enabled namespace/default labeled
2. istio profile별 제공 기능 [![image.png](http://igoni.kr/uploads/images/gallery/2023-12/scaled-1680-/image.png)](http://igoni.kr/uploads/images/gallery/2023-12/image.png) 3. istio 서비스 상태 확인 ```shell $ kubectl get all -n istio-system NAME READY STATUS RESTARTS AGE pod/istio-ingressgateway-78d7b9b7db-zpxxf 1/1 Running 2 19d pod/istiod-85c8645bbc-4jkbj 1/1 Running 1 19d NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE service/istio-ingressgateway LoadBalancer 10.233.14.72  15021:31094/TCP,80:32134/TCP,443:31338/TCP,15012:30093/TCP,15443:30233/TCP 20d service/istiod ClusterIP 10.233.43.248  15010/TCP,15012/TCP,443/TCP,15014/TCP 20d service/tracing NodePort 10.233.13.45  16686:30008/TCP 17d NAME READY UP-TO-DATE AVAILABLE AGE deployment.apps/istio-ingressgateway 1/1 1 1 20d deployment.apps/istiod 1/1 1 1 20d NAME DESIRED CURRENT READY AGE replicaset.apps/istio-ingressgateway-78d7b9b7db 1 1 1 20d replicaset.apps/istiod-85c8645bbc 1 1 1 20d NAME REFERENCE TARGETS MINPODS MAXPODS REPLICAS AGE horizontalpodautoscaler.autoscaling/istio-ingressgateway Deployment/istio-ingressgateway /80% 1 5 1 20d horizontalpodautoscaler.autoscaling/istiod Deployment/istiod /80% 1 5 1 20d ``` 4. Addon 설치 1. Kiali : Istio 모니터링을 위한 대쉬보드 2. Jager / zipkin : 분산 시스템 모니터링 1. zipkin : Twitter에서 개발한 오픈소스 2. jaeger: Uber에서 개발하고 CNCF 프로젝트로 진행중인 오픈소스. (k8s환경에서는 jaeger가 효율적이라는...) 5. addon 설치 ```shell $ wget  http://172.21.115.91:28080/... $ kubectl apply -f ./sample/ $ kubectl get all -n istio-system NAME                                        READY   STATUS    RESTARTS   AGE pod/istio-ingressgateway-78d7b9b7db-zpxxf   1/1     Running   2          19d pod/istiod-85c8645bbc-4jkbj                 1/1     Running   1          19d pod/jaeger-7f78b6fb65-jcrgz                 1/1     Running   1          17d pod/kiali-dc84967d9-cqn8v                   1/1     Running   1          19d pod/prometheus-7bfddb8dbf-vsddf             2/2     Running   4          19d NAME                           TYPE           CLUSTER-IP      EXTERNAL-IP   PORT(S)                                                                      AGE service/istio-ingressgateway   LoadBalancer   10.233.14.72         15021:31094/TCP,80:32134/TCP,443:31338/TCP,15012:30093/TCP,15443:30233/TCP   20d service/istiod                 ClusterIP      10.233.43.248           15010/TCP,15012/TCP,443/TCP,15014/TCP                                        20d service/jaeger-collector       ClusterIP      10.233.35.73            14268/TCP,14250/TCP                                                          17d service/kiali                  NodePort       10.233.21.50            20001:30007/TCP,9090:31990/TCP                                               20d service/prometheus             ClusterIP      10.233.24.217           9090/TCP                                                                     20d service/tracing                NodePort       10.233.13.45            16686:30008/TCP                                                              17d service/zipkin                 ClusterIP      10.233.34.17            9411/TCP                                                                     17d NAME                                   READY   UP-TO-DATE   AVAILABLE   AGE deployment.apps/istio-ingressgateway   1/1     1            1           20d deployment.apps/istiod                 1/1     1            1           20d deployment.apps/jaeger                 1/1     1            1           17d deployment.apps/kiali                  1/1     1            1           20d deployment.apps/prometheus             1/1     1            1           20d NAME                                              DESIRED   CURRENT   READY   AGE replicaset.apps/istio-ingressgateway-78d7b9b7db   1         1         1       20d replicaset.apps/istiod-85c8645bbc                 1         1         1       20d replicaset.apps/jaeger-7f78b6fb65                 1         1         1       17d replicaset.apps/kiali-dc84967d9                   1         1         1       20d replicaset.apps/prometheus-7bfddb8dbf             1         1         1       20d NAME                                                       REFERENCE                         TARGETS         MINPODS   MAXPODS   REPLICAS   AGE horizontalpodautoscaler.autoscaling/istio-ingressgateway   Deployment/istio-ingressgateway   /80%   1         5         1          20d horizontalpodautoscaler.autoscaling/istiod                 Deployment/istiod                 /80%   1         5         1          20d ``` 6. 대쉬보드 외부 접속하기 1. kiali : http://{{서버IP}}:30007 2. jaeger: http://{{서버IP}}:30008 1.삭제 ```shell $ istioctl x uninstall --purge kubectl delete namespace istio-system ``` 7. 시스템 설정을 위한 설정값 안내 Component list
**항목****용도****기타**
gatewayhttp / tcp를 연결하기 위해 구성하는 로드밸런서
virtualserviceservice게이트웨이에 바인딩 후 트래픽을 구성된 여러 엔드포인트로 전달 (트래픽 비율설정)
virtualserviceversion(a.k.a subset)특정 서비스에 대해 어플리케이션 바이너리의 버전 변경을 실행하는 집합
virtualservicesource서비스를 호출하는 다운스트림용 클라이언트
virtualservicehost클라이언트가 서비스 연결할때 사용하는 주소
destinationRule라우팅 규칙을 처리한 후 연결할 네트워크 서비스를 설정
tcproutetcp트래픽에 대해 라우팅 규칙을 위한 조건 설정
tcproutematch활성화할 규칙조건
tcprouteroute연결할 대상
8. Example yml 1. gateway 설정 (tcp/30011에 대해 gateway 설정) ```shell $vi gateway.yml --- apiVersion: networking.istio.io/v1beta1 kind: Gateway metadata:   name: gateway   namespace: test spec:   selector:     app: test   servers:     - hosts:         - '*'       port:         name: tcp         number: 30011         protocol: TCP ``` 9. VirtualService 설정 (tcp/30011이 들어오면 service111-1, service111-2의 tcp/8080으로 연결하되 50%씩 트래픽 분할 처리) ```shell $ vi vs.yaml --- apiVersion: networking.istio.io/v1beta1 kind: VirtualService metadata:   name: test-vs   namespace: test spec:   gateways:     - gateway   hosts:     - appid111   tcp:     - match:         - port: 30011       route:         - destination:             host: appid111-1             port:               number: 3390             subset: v1           weight: 50         - destination:             host: appid111-2             port:               number: 3390             subset: v2           weight: 50 ``` 10. destinationrule 설정 (service111에 대해 v1, v2 설정) ```shell $ vi rule.yml --- apiVersion: networking.istio.io/v1beta1 kind: DestinationRule metadata:   name: test-rule   namespace: test spec:   host: appid111   subsets:     - labels:         version: 'v1'       name: v1     - labels:         version: 'v2'       name: v2   trafficPolicy:     loadBalancer:       simple: ROUND_ROBIN     tls:       mode: DISABLE ``` reference [https://istio.io/latest/docs/setup/getting-started/](https://istio.io/latest/docs/setup/getting-started/)