데보션앱 소개페이지 바로가기
로그인 선택

신고하기

CLOSE
신고사유 (대표 사유 1개)
상세내용 (선택)
0/200
  • 신고한 게시글은 더 이상 보이지 않습니다.
  • 이용약관과 운영정책에 따라 신고사유에 해당하는지 검토 후 조치됩니다.
  • 허위 신고인 경우, 신고자의 서비스 이용이 제한될 수 있으니 유의하시어 신중하게 신고해 주세요.
(이 회원이 작성한 모든 댓글과 커뮤니티 게시물이 보이지 않고, 알림도 오지 않습니다.)

미리보기

커뮤니티

      1,234

      badge 23.06.15

      글 등록

      카테고리를 선택해주세요.

      DEVOTEE를 활성화 시키면
      지금 작성한 커뮤니티 글에 대해 1개의 댓글을 달아줍니다.

      버튼을 누르면 글 수정 시 ChatGPT가 작성한 댓글이 수정됩니다.

      임시저장함에 저장되었습니다. 저장일시 : 2022.5.17 14:29:08

      임시저장함

      제목을 선택하시면 이어서 작성이 가능하며,
      최대 20건까지 저장합니다.
      컨텐츠 유형, 제목, 저장일시, 삭제로 이뤄진 임시저장 목록
      컨텐츠 유형 제목 저장일 삭제

      데보션 블로그 게재 요청

      CLOSE
      • *
      • *

      본인인증

      효율적인 데보션 서비스 이용 및
      고객님의 소중한 개인정보보호를 위해
      본인인증을 진행해주세요. 본인인증 미 진행 시 로그인이 제한됩니다.
      본인인증 실패

      본인인증 로그인에 실패하였습니다.
      회원이 아니시거나 본인인증 등록이
      완료되지 않은 사용자입니다.

      회원정보 연결

      Istio Production Ready 로 설치하기

      seungkyua 21.03.17
      1,178 3 1

      Istio 의 설치 순서는 다음과 같다.

      사전에 Prometheus 와 EasticSearch 는 설치되어 있다고 가정한다.

      1. istio operator 설치
      2. istio control plane 을 위한 istio custom resource 생성
      3. 서비스별 gateway 설치
      4. Jaeger 설치
      5. Kiali 설치

       

      1. istio operator 설치

      istio operator 를 설치하기 전에 istioctl 명령을 사용할 수 있게 파일을 다운로드 한다.

      $ mkdir -p ~/ahnsk/istio && cd ~/ahnsk/istio
      $ curl -L https://git.io/getLatestIstio | ISTIO_VERSION=1.9.1 sh -
      $ cd ~/ahnsk/istio/istio-1.9.1
       
      $ cp bin/istioctl /usr/local/bin/istioctl

      istio operator 는 helm chart 로 설치하며, 따로 helm repo 를 등록하지 않고 istio source 를 다운받아 설치한다.

      먼저, istio 소스를 다운 받는다.

      $ cd ~/ahnsk/istio
      $ git clone https://github.com/istio/istio.git istio-operator
      $ cd istio-operator
      $ git checkout -b tag_1.9.1 tags/1.9.1

      istio operator 를 helm 으로 설치한다.

      istio 는 control plane 을 canary upgrade  가 가능하도록 revision tag 로 구분할 수 있게 권장하고 있다. 그리고 istio-operator 네임스페이스에 operator 를 설치하고, istio-system 네임스페이스에 istio control plane 을 설치한다.

      operator 를 생성할 때 istio-operator 네임스페이스는 자동으로 생성되나 istio-system 네임스페이스는 operator 를 설치하기 전에 수동으로 생성해 놓아야 한다.

      $ cd ~/ahnsk/istio
      $ vi istio-operator-values.yaml
      ---
      revision: "1-9-1"
      operatorNamespace: istio-operator
      watchedNamespaces: istio-system
      operator:
        resources:
          limits:
            cpu: 4
            memory: 4Gi
          requests:
            cpu: 2
            memory: 2Gi
       
      $ kubectl create ns istio-system
      $ helm upgrade -i istio-operator ./istio-operator/manifests/charts/istio-operator -f istio-operator-values.yaml -n istio-system
      

       

      2. istio control plane 설치

      istio control plane 은 istiod 라는 pod 로 설치된다. operator 가 있으므로 아래와 같이 custom resource 를 생성하면 자동으로 istio control plane 이 설치되는 구조이다.

      custom resource 를 아래와 같이 생성한다.

      $ vi istio-cr-1-9-1.yaml
      ---
      apiVersion: install.istio.io/v1alpha1
      kind: IstioOperator
      metadata:
        namespace: istio-system
        name: istio-controlplane
      spec:
        revision: "1-9-1"
        profile: default
        meshConfig:
          accessLogFile: /dev/stdout
          enableTracing: true
          enablePrometheusMerge: true
          defaultConfig:
            discoveryAddress: istiod-1-9-1.istio-system.svc:15012
            proxyMetadata: {}
            tracing:
              zipkin:
                address: jaeger-operator-jaeger-collector.istio-system:9411
              sampling: 100.0
        values:
          global:
            logging:
              level: "default:info"
            istioNamespace: istio-system
        components:
          pilot:
            k8s:
              env:
              - name: PILOT_TRACE_SAMPLING
                value: "100"
              resources:
                requests:
                  cpu: 1000m
                  memory: 1024Mi
              hpaSpec:
                maxReplicas: 10
                minReplicas: 2
              nodeSelector:
                taco-istio: enabled
          egressGateways:
          - name: istio-egressgateway
            namespace: istio-system
            enabled: true
            k8s:
              resources:
                requests:
                  cpu: 1000m
                  memory: 1024Mi
              hpaSpec:
                maxReplicas: 10
                minReplicas: 2
              nodeSelector:
                taco-istio: enabled
          ingressGateways:
          - name: istio-ingressgateway
            namespace: istio-system
            enabled: true
            k8s:
              resources:
                requests:
                  cpu: 1000m
                  memory: 1024Mi
              hpaSpec:
                maxReplicas: 10
                minReplicas: 2
              nodeSelector:
                taco-istio: enabled
              service:
                type: NodePort
                ports:
                - name: status-port
                  port: 15021
                  targetPort: 15021
                - name: http2
                  port: 80
                  targetPort: 8080
                  nodePort: 31080
                - name: https
                  port: 443
                  targetPort: 8443
                  nodePort: 30443
                - name: tcp
                  port: 31400
                  targetPort: 31400
                - name: tls
                  port: 15443
                  targetPort: 15443

       

      • revision 은 control plane 을 구별하기 위해서 사용한다.
      • meshConfig 는 istiod 와 envoy proxy 가 서로 연결되는 정보를 나타내며 discoveryAddress 는 control plane 인 istiod 의 service url 을 tracing 은 Jaeger 정보를 저장할 데이터소스 url 이다. 여기서는 jaeger tracing backend 로 elastic search 를 사용하고 있다. meshConfig 의 값은 istiod 가 설치되는 istio-system 네임스페이스에 istiod-1-9-1 이라는 이름의 ConfigMap 으로 저장된다.
      • components 는 pilot(istiod), ingressGateway, egressGateway 에 대한 설치 정보이다. hpa 로 auto scaling 을 활용하기 위해서는 kubernetes cluster 에 metric-server 가 설치되어 있어야 한다.

      아래와 같이 custom resource 를 생성한다.

      사전에 node-selector 로 어느 서버에 istiod 와 gateway 를 설치할 수 있는지 지정할 수 있다.

      $ kubectl label node k1-node03 taco-istio=enabled
      $ kubectl label node k1-node04 taco-istio=enabled
      $ kubectl label node k1-node05 taco-istio=enabled
       
      $ kubectl apply -f istio-cr-1-9-1.yaml

       

      설치 현황은 아래 명령으로 확인할 수 있다.

      $ kubectl get iop -n istio-system
      -----------------------------------------------
      NAME                   REVISION   STATUS    AGE
      istio-controlplane     1-9-1      HEALTHY   44h

       

      3. 서비스별 gateway 추가 설치

      gateway 는 서비스별로 추가할 수 있다. 이 또한 custom resource 만 생성하면 되며 custom resource 는 아래와 같다.

      $ vi istio-gateway-cr.yaml
      ---
      apiVersion: install.istio.io/v1alpha1
      kind: IstioOperator
      metadata:
        namespace: istio-system
        name: istio-gateway-sample
      spec:
        revision: "1-9-1"
        profile: empty
        values:
          global:
            logging:
              level: "default:info"
            istioNamespace: istio-system
        components:
          ingressGateways:
          - name: istio-ingressgateway-istio-gateway-sample
            namespace: istio-gateway-sample
            label:
              app: istio-ingressgateway-istio-gateway-sample
              istio: ingressgateway-istio-gateway-sample
            enabled: true
            k8s:
              resources:
                requests:
                  cpu: 1000m
                  memory: 1024Mi
              hpaSpec:
                maxReplicas: 10
                minReplicas: 2
              nodeSelector:
                taco-istio: enabled
              service:
                type: NodePort
                ports:
                - name: status-port
                  port: 15021
                  targetPort: 15021
                - name: http2
                  port: 80
                  targetPort: 8080
                  nodePort: 31081
                - name: https
                  port: 443
                  targetPort: 8443
                  nodePort: 31443
                - name: tcp
                  port: 31400
                  targetPort: 31400
                - name: tls
                  port: 15443
                  targetPort: 15443

       

      • profile 값은 empty 로 지정한다. empty 는 istiod 를 설치하지 않겠다는 뜻이다.
      • Gateway  에 label 은 중요하다. default label 값은 app=istio-ingressgateway 와 istio=ingressgateway 이다. Gateway 를 여러개 설치하면 서비스별로 VirtualService 와 연결해야 하는데 이 때 활용되는 것이 label 이다. 그러니 Gateway 별로 구별할 수 있게 label 을 서로 다르게 주는 것이 중요하다.
      • 새로운 네임스페이스에 생성된 Gateway 에 istiod 와 연결할 url 정보를 주는 것이 중요하다. 그런데 그 정보를 갖고 있는 meshConfig 에 넣어도 새로운 네임스페이스에 istio-1-9-1 ConfigMap 이 생성되지 않는다. 그래서 istio-1-9-1 ConfigMap 은 수동으로 설치해 주어야 한다.

      Gateway 를 설치할 네임스페이스 생성과 그 네임스페이스에 istio-system 에 있는 istio-1-9-1 ConfigMap 을 복사하여 생성한다.

      $ kubectl create ns istio-gateway-sample
       
      $ kubectl get cm istio-1-9-1 -n istio-system -o yaml \
      | grep -v '^\s*namespace:\s' \
      | kubectl apply -f -n istio-gateway-sample -

       

      custom resource 를 생성하여 Gateway 를 추가로 설치한다.

      $ kubectl apply -f istio-gateway-cr.yaml

       

      설치된 정보를 확인한다.

      $ kubectl get iop -A
      ----------------------------------------------------------------
      NAMESPACE      NAME                   REVISION   STATUS    AGE
      istio-system   istio-controlplane     1-9-1      HEALTHY   45h
      istio-system   istio-gateway-sample   1-9-1      HEALTHY   42h
       
       
       
      # istioctl proxy-status
      -----------------------------------------------------------------
      NAME                                                                                CDS        LDS        EDS        RDS          ISTIOD                            VERSION
      api-gateway-6f87d9477f-xg5dq.default                                                SYNCED     SYNCED     SYNCED     SYNCED       istiod-1-9-1-58ff56d6f8-dftbh     1.10-alpha.ba8228cc703fa11542c3e97c1702688d072152a1
      details-v1-6f769b44-hzj8v.default                                                   SYNCED     SYNCED     SYNCED     SYNCED       istiod-1-9-1-58ff56d6f8-25z28     1.10-alpha.ba8228cc703fa11542c3e97c1702688d072152a1
      istio-egressgateway-66cb5c46c7-c9q4b.istio-system                                   SYNCED     SYNCED     SYNCED     NOT SENT     istiod-1-9-1-58ff56d6f8-dftbh     1.10-alpha.f88f93ff2b8172b37c83d6066363d76b4477bd2d
      istio-egressgateway-66cb5c46c7-qjrwj.istio-system                                   SYNCED     SYNCED     SYNCED     NOT SENT     istiod-1-9-1-58ff56d6f8-25z28     1.10-alpha.f88f93ff2b8172b37c83d6066363d76b4477bd2d
      istio-ingressgateway-684d9c7755-brtsv.istio-system                                  SYNCED     SYNCED     SYNCED     SYNCED       istiod-1-9-1-58ff56d6f8-25z28     1.10-alpha.f88f93ff2b8172b37c83d6066363d76b4477bd2d
      istio-ingressgateway-684d9c7755-dvtrd.istio-system                                  SYNCED     SYNCED     SYNCED     SYNCED       istiod-1-9-1-58ff56d6f8-dftbh     1.10-alpha.f88f93ff2b8172b37c83d6066363d76b4477bd2d
      istio-ingressgateway-istio-gateway-sample-6d6998fc44-rnfnr.istio-gateway-sample     SYNCED     SYNCED     SYNCED     SYNCED       istiod-1-9-1-58ff56d6f8-dftbh     1.10-alpha.f88f93ff2b8172b37c83d6066363d76b4477bd2d
      istio-ingressgateway-istio-gateway-sample-6d6998fc44-twcqp.istio-gateway-sample     SYNCED     SYNCED     SYNCED     SYNCED       istiod-1-9-1-58ff56d
      

       

      4. sidecar auto injection 을 위한 레이블 설정

      Istio 를 Operator 를 사용해서 revision 값을 주면 sidecar 를 자동으로 injection 하기 위해서 더이상 istio-injection=enabled 와 같은 Label을 쓰지 않는다. 위에 처럼 label 을 변경줘야 한다. istio-injection=enabled 으로 설명하는 문서들이 있으면 demo 와 같은 simple 한 설치이거나 이전 설치 방법이다.

      $ kubectl label ns default istio.io/rev=1-9-1

       

       

       


      jaeger 와 kiali 는 다음에 계속..

       

       

       

      댓글 0

      DEVOTEE를 활성화 시키면
      지금 작성한 댓글에 AI가 댓글을 달아줍니다.

      seungkyua 님의 최신 블로그

      더보기
      동영상 기고하기