ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • istio 설치하기
    Envoy & Istio 2019. 8. 19. 09:00
    반응형

     

    Docker for Desktop에 설치하기

     

    준비하기

    그림처럼 CPU는 4코어 이상사용하게 하고 메모리는 5기가 이상 사용하게 설정이 되어 있어야 함.

     

    istio를 다운로드 받아서 실행할수 있게 path에 추가

    curl -L https://git.io/getLatestIstio | ISTIO_VERSION=1.1.7 sh -
    cd istio-1.1.7
    export PATH=$PWD/bin:$PATH

     

    istio 설치 시작

    istio용 CRD를 먼저 설치한다.

    for i in install/kubernetes/helm/istio-init/files/crd*yaml; do kubectl apply -f $i; done

     

    istio 설치

    kubectl apply -f install/kubernetes/istio-demo.yaml

     

    istio-system 네임스페이스에 필요한 pod들이 생성됨

    kubectl get pods -n istio-system
    
    NAME                                      READY   STATUS              RESTARTS   AGE
    grafana-77b49c55db-58s75                  0/1     ContainerCreating   0          32s
    istio-citadel-66d49b64fc-tdf92            1/1     Running             0          32s
    istio-cleanup-secrets-1.1.7-djs59         0/1     ContainerCreating   0          33s
    istio-egressgateway-68d9cfdd4-vkff8       0/1     ContainerCreating   0          32s
    istio-galley-676599ffb4-rnhtl             0/1     ContainerCreating   0          32s
    istio-grafana-post-install-1.1.7-cd7v8    0/1     ContainerCreating   0          34s
    istio-ingressgateway-7fbf7bcf45-vrmp5     0/1     ContainerCreating   0          32s
    istio-pilot-56b4dd7bd7-h5mtr              0/2     ContainerCreating   0          32s
    istio-policy-7bcc6d45df-9zh6v             0/2     ContainerCreating   0          32s
    istio-security-post-install-1.1.7-r8h8n   0/1     Completed           0          33s
    istio-sidecar-injector-779544894b-gbdkb   0/1     ContainerCreating   0          31s
    istio-telemetry-d6f5cd5d9-rv2t4           0/2     ContainerCreating   0          32s
    istio-tracing-595796cf54-npkm7            0/1     Running             0          31s
    kiali-5c584d45f6-cgb5w                    0/1     ContainerCreating   0          32s
    prometheus-5fffdf8848-vzqvx               0/1     ContainerCreating   0          32s

     

    서비스들도 생김

    kubectl get svc -n istio-system
    
    NAME                     TYPE           CLUSTER-IP       EXTERNAL-IP   PORT(S)                                                                                                                                      AGE
    grafana                  ClusterIP      10.97.114.17     <none>        3000/TCP                                                                                                                                     3m54s
    istio-citadel            ClusterIP      10.107.9.144     <none>        8060/TCP,15014/TCP                                                                                                                           3m53s
    istio-egressgateway      ClusterIP      10.104.197.51    <none>        80/TCP,443/TCP,15443/TCP                                                                                                                     3m54s
    istio-galley             ClusterIP      10.106.239.112   <none>        443/TCP,15014/TCP,9901/TCP                                                                                                                   3m54s
    istio-ingressgateway     LoadBalancer   10.102.123.254   localhost     15020:32186/TCP,80:31380/TCP,443:31390/TCP,31400:31400/TCP,15029:30742/TCP,15030:30721/TCP,15031:32150/TCP,15032:31170/TCP,15443:32300/TCP   3m54s
    istio-pilot              ClusterIP      10.108.36.141    <none>        15010/TCP,15011/TCP,8080/TCP,15014/TCP                                                                                                       3m53s
    istio-policy             ClusterIP      10.101.239.165   <none>        9091/TCP,15004/TCP,15014/TCP                                                                                                                 3m54s
    istio-sidecar-injector   ClusterIP      10.109.225.160   <none>        443/TCP                                                                                                                                      3m53s
    istio-telemetry          ClusterIP      10.100.225.229   <none>        9091/TCP,15004/TCP,15014/TCP,42422/TCP                                                                                                       3m53s
    jaeger-agent             ClusterIP      None             <none>        5775/UDP,6831/UDP,6832/UDP                                                                                                                   3m53s
    jaeger-collector         ClusterIP      10.104.21.100    <none>        14267/TCP,14268/TCP                                                                                                                          3m53s
    jaeger-query             ClusterIP      10.101.105.237   <none>        16686/TCP                                                                                                                                    3m53s
    kiali                    ClusterIP      10.98.90.5       <none>        20001/TCP                                                                                                                                    3m54s
    prometheus               ClusterIP      10.109.110.218   <none>        9090/TCP                                                                                                                                     3m53s
    tracing                  ClusterIP      10.105.165.57    <none>        80/TCP                                                                                                                                       3m53s
    zipkin                   ClusterIP      10.105.86.12     <none>        9411/TCP                                                                                                                                     3m53s

     

    지금부터 쿠버네티스 클러스터에 pod를 만들면 istio sidecar injector 가 자동으로 envoy 컨테이너를 사용자가 만든 pod에 추가함. 

    envoy 사이드카 컨테이너를 추가하는 기준은 istio-injection-enabled라고 추가 되어 있는 네임스페이스에 적용됨.

    테스트용으로 default 네임스페이스에 레이블을 추가하고 전체 네임스페이스를 확인해보면 다음처럼 보임

    $ kubectl label namespace default istio-injection=enabled
    namespace/default labeled
    
    $ kubectl get ns -o jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.metadata.labels}{"\t"}{"\n"}{end}'
    default    map[istio-injection:enabled]
    docker
    istio-system    map[istio-injection:disabled]
    kube-public
    kube-system

     

    istio-injection=enabled 이 설정되지 않은 네임스페이스에 앱을 배포하려면 istioctl 명령어를 이용해서 yaml 파일을 변경할 수 있음.

    기존에 사용하던 yaml 파일을 다음처럼 실행하면 istio 관련 설정이 추가된 yaml 파일 내용이 출력됨. 그 내용을 다른이름으로 저장한 다음에 kubectl 로 실행하면 됨.

    istioctl kube-inject -f my-app.yaml

     

    이제 테스트 삼아 앱을 하나 실행 시켜봄

    kubectl run --image=nginx nginx

     

    확인해 보면 pod에 컨테이너가 2개 들어 있음.

    kubectl get pods
    NAME                     READY   STATUS    RESTARTS   AGE
    nginx-7cdbd8cdc9-sk9db   2/2     Running   0          4m14s
    

     

    describe로 확인해 보면 istio-proxy 컨테이너가 추가되어 있는걸 확인할 수 있음.

    kubectl describe pods -l run=nginx
    ...
    Containers:
      nginx:
        Container ID:   docker://3f3cc356cea9d1746684eb0eed42b7f93dbd6d8d698b3c1c62d4dee282391536
        Image:          nginx
        Image ID:       docker-pullable://nginx@sha256:23b4dcdf0d34d4a129755fc6f52e1c6e23bb34ea011b315d87e193033bcd1b68
      istio-proxy:
        Container ID:  docker://00707bfe6c22f7ed51f8845abe92674fb2e9470bb75ea0685f967807e6fab642
        Image:         docker.io/istio/proxyv2:1.1.7
        Image ID:      docker-pullable://istio/proxyv2@sha256:e6f039115c7d5ef9c8f6b049866fbf9b6f5e2255d3a733bb8756b36927749822
        Port:          15090/TCP
    ...

     

    참조 

    https://istio.io/docs/setup/kubernetes/install/kubernetes/

     

     

    반응형

    댓글

Designed by Tistory.