Istio 설치하기

알파로그·2023년 7월 24일
0

Kubernetes

목록 보기
14/15

✏️ Istio

  • Kubernetes 의 Cluster 에서 외부 트래픽을 내부로 라우팅 시켜주는 솔루션이다.
  • 🔗 Ingress Vs. Istio

📍 설치 하기

🔗 Istio 설치 공식 문서

  • istio 다운로드
curl -L https://istio.io/downloadIstio | sh -
  • 설정 파일 이동
    • 폴더명의 버전은 시간에 따라 달라질 수 있음
cp istio-1.18.1/bin/istioctl /usr/local/bin/

📍 설정파일 작성

  • istio.yaml 로 생성했다.
    • Egress Gateway
      • 클러스터에서 외부로 나가는 트래픽을 제어한다.
      • 설정파일에서는 최소 2개의 replica 가 생성되도록 작성되어있다.
    • Ingress Gateway
      • 외부에서 클러스터 내부로 들어오는 트래픽을 제어한다.
      • 마찬가지로 최소 2개의 replica 가 생성되도록 작성되어있다.
    • Pilot
      • 라우팅 구성 정보를 전달하고, 에러 검출, 로드벨런싱 등의 작업을 제어한다.
    • Mesh Config
      • 서비스 메시 구성에 대한 설정을 제어한다.
      • enableTracing : 서비스간의 트래픽 추적이 활성화 되도록 설정
      • holdApplicationUntilProxyStarts : 프록시 시작 전에 앱이 실행되지 않도록 설정
        • 사이드카 프록시가 준비되고 난 후에만 앱이 실행됨
apiVersion: install.istio.io/v1alpha1
kind: IstioOperator

metadata:
  namespace: istio-system
  name: istiocontrolplane

spec:
  profile: default
  components:

    egressGateways:
    - name: istio-egressgateway
      enabled: true
      k8s:
        hpaSpec:
          minReplicas: 1

    ingressGateways:
    - name: istio-ingressgateway
      enabled: true
      k8s:
        hpaSpec:
          minReplicas: 1

    pilot:
      enabled: true
      k8s:
        hpaSpec:
          minReplicas: 1

  meshConfig:
    enableTracing: true
    defaultConfig:
      holdApplicationUntilProxyStarts: true
    accessLogFile: /dev/stdout
    outboundTrafficPolicy:
      mode: REGISTRY_ONLY

📍 설정파일 실행하기

  • 생성한 설정파일을 기준으로 istio 를 실행시킬 수 있다.
istioctl install -f istio.yaml

📍 설치 확인하기

  • 아래 명령어로 Kubernetes 에 설치된 모든 프로그램을 확인할 수 있다.
# kubectl get ns
NAME               STATUS   AGE
calico-apiserver   Active   7d10h
calico-system      Active   7d10h
default            Active   7d10h
istio-system       Active   2m19s # istio 설치 완료
kube-node-lease    Active   7d10h
kube-public        Active   7d10h
kube-system        Active   7d10h
tigera-operator    Active   7d10h
  • name space 를 사용해 더 디테일 하게 확인하는 방법도 있다.
    • 모든 기능이 정상적으로 작동되고 있다.
# kubectl get all -n istio-system
NAME                                        READY   STATUS    RESTARTS   AGE
pod/istio-egressgateway-bd689f9cf-2fpf2     1/1     Running   0          4m48s
pod/istio-egressgateway-bd689f9cf-6dhss     1/1     Running   0          4m33s
pod/istio-ingressgateway-67898c8868-69m8s   1/1     Running   0          4m48s
pod/istio-ingressgateway-67898c8868-l7kr4   1/1     Running   0          4m33s
pod/istiod-ff577f8b8-jlv5s                  1/1     Running   0          4m47s
pod/istiod-ff577f8b8-p26hl                  1/1     Running   0          5m2s

NAME                           TYPE           CLUSTER-IP       EXTERNAL-IP   PORT(S)                                      AGE
service/istio-egressgateway    ClusterIP      10.108.235.119   <none>        80/TCP,443/TCP                               4m48s
service/istio-ingressgateway   LoadBalancer   10.105.48.61     <pending>     15021:30498/TCP,80:32436/TCP,443:30896/TCP   4m48s
service/istiod                 ClusterIP      10.108.230.28    <none>        15010/TCP,15012/TCP,443/TCP,15014/TCP        5m2s

NAME                                   READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/istio-egressgateway    2/2     2            2           4m48s
deployment.apps/istio-ingressgateway   2/2     2            2           4m48s
deployment.apps/istiod                 2/2     2            2           5m2s

NAME                                              DESIRED   CURRENT   READY   AGE
replicaset.apps/istio-egressgateway-bd689f9cf     2         2         2       4m48s
replicaset.apps/istio-ingressgateway-67898c8868   2         2         2       4m48s
replicaset.apps/istiod-ff577f8b8                  2         2         2       5m2s

NAME                                                       REFERENCE                         TARGETS         MINPODS   MAXPODS   REPLICAS   AGE
horizontalpodautoscaler.autoscaling/istio-egressgateway    Deployment/istio-egressgateway    <unknown>/80%   2         5         2          4m48s
horizontalpodautoscaler.autoscaling/istio-ingressgateway   Deployment/istio-ingressgateway   <unknown>/80%   2         5         2          4m48s
horizontalpodautoscaler.autoscaling/istiod                 Deployment/istiod                 <unknown>/80%   2         5         2          5m2s

📍 설정파일 수정하기

  • ingress gateway 의 external-ip 가 pending 상태이므로 원하는 ip 를 수정으로 작성시킬 수 있다.
kubectl edit svc istio-ingressgateway -n istio-system
profile
잘못된 내용 PR 환영

0개의 댓글