Istio 설치

Istio 는 쿠버네티스의 Network 레벨의 Mesh 서비스다. 비교하자면 Netflix OSS 에 Ribbon 과 비슷하다고 볼 수 있다.

Istio 설치 방법

Istio 설치 방법은 다양하다. 처음에 Istio 를 시작할때에 가장 헷깔리는 것이 바로 설치 방법이다. 구글에서 검색을 하면 설치방법이 나오지만 읽어보면 제각각인 이유가 다양한 설치 방법 때문이다.

그래서인지 Istio 홈페이지에서 다양한 설치 방법을 적어놨는데 대략 3가지 방법이 많이 쓰인다.

  1. Install with Istioctl
  2. Install with Helm
  3. Install Istio Operator

여기서는 Istoctl 을 이용해 설치하는 법을 다룬다. 이 방법은 다음 문서에 잘 나와 있다.

Download Istioctl

다음과 같이 Istio 를 다운로드 한다.

$ curl -L https://istio.io/downloadIstio | sh -
$ sudo cp istio-1.13.0/bin/istioctl /usr/local/bin/
[sudo] password for systemv:
$ sudo chmod +x /usr/local/bin/istioctl

istio profile

istioctl 은 말그대로 istio 관련 작업을 위한 툴이다. 설치를 할때도 이를 활용할 수 있다.

istio 설치는 미리 정의되어 있는 프로파일을 정의하면 그 프로파일에 맞는 컴포넌트들을 같이 설치해 준다. 미리정의된 프로파일은 다음과 같이 조회가 가능하다.

$ istioctl profile list
Istio configuration profiles:
    default
    demo
    empty
    external
    minimal
    openshift
    preview
    remote

프로파일의 내용은 대략 다음과 같다.

  • default: 프로덕트 환경에 적합하도록 기본세팅되어 있다.
  • demo: 쇼케이스를 위해서 세팅된 값을 쓴다.
  • minimal: 오진 컨트롤 플레인만 설치된다.
  • empty: 아무것도 디폴로이 되지 않는다. 이것은 커스텀 설정을 위한 베이스 프로파일처럼 사용할 수 있다.

각 프로파일의 내용은 다음과 같이 dump 옵션을 사용해 가능하다.

$ istioctl profile dump default
apiVersion: install.istio.io/v1alpha1
kind: IstioOperator
spec:
  components:
    base:
      enabled: true
    cni:
      enabled: false
    egressGateways:
    - enabled: false
      name: istio-egressgateway
    ingressGateways:
    - enabled: true
      name: istio-ingressgateway
    istiodRemote:
      enabled: false
    pilot:
      enabled: true
  hub: docker.io/istio
  meshConfig:
    defaultConfig:
      proxyMetadata: {}
    enablePrometheusMerge: true
  profile: default
  tag: 1.13.0

위 내용을 보면, cni, egressGateway 와 istiodRemote 가 비활성화 되어 있다.

전체설정의 서브셋만 보고 싶다면 –config-path 를 사용하면 가능하다.

$ istioctl profile dump --config-path components.cni default
enabled: false

프로파일에 차이를 알고 싶다면 다음과 같이 확인할 수 있다.

$ istioctl profile diff default demo
The difference between profiles:
 apiVersion: install.istio.io/v1alpha1

demo profile 설치

demo 프로파일을 이용해 설치를 진행 한다. istio 문서대로 한번 해보는 것이다.

$ istioctl install --set profile=demo -y
✔ Istio core installed                                                                                                                                                                                
✔ Istiod installed                                                                                                                                                                                    
✔ Egress gateways installed                                                                                                                                                                           
✔ Ingress gateways installed                                                                                                                                                                          
✔ Installation complete                                                                                                                                                                               Making this installation the default for injection and validation.

Thank you for installing Istio 1.13.  Please take a few minutes to tell us about your install/upgrade experience!  https://forms.gle/pzWZpAvMVBecaQ9h9

자동으로 Envoy 사이드카 프록시를 자동으로 주입시키기 위한 네임스페이스에 라벨을 추가해준다.

$ kubectl label namespace default istio-injection=enabled
namespace/default labeled

default 네임스페이스에 라벨링을 해줬다. default 네임스페이스에 드플로이를 해주면 Envoy 사이드카가 자동으로 주입된다.

istio 설치 확인

먼저 네임스페이스를 확인해 보자. 네임스페이스는 istio-system 이 생성된다.

$ kubectl get ns
NAME              STATUS   AGE
default           Active   300d
ingress-nginx     Active   16d
istio-system      Active   4m54s
kube-node-lease   Active   300d
kube-public       Active   300d
kube-system       Active   300d
metallb-system    Active   204d
monitoring        Active   201d

그리고 이제 어떤것이 설치되었는지를 살펴보자.

$ kubectl get all -n istio-system
NAME                                       READY   STATUS    RESTARTS   AGE
pod/istio-egressgateway-599c8845c9-hcp24   1/1     Running   0          8m31s
pod/istio-ingressgateway-69dc56d7f-64xl4   1/1     Running   0          8m31s
pod/istiod-8c75fcbc9-d6svq                 1/1     Running   0          8m51s

NAME                           TYPE           CLUSTER-IP    EXTERNAL-IP     PORT(S)                                                                      AGE
service/istio-egressgateway    ClusterIP      10.32.0.43              80/TCP,443/TCP                                                               8m29s
service/istio-ingressgateway   LoadBalancer   10.32.0.206   192.168.111.5   15021:30526/TCP,80:32234/TCP,443:30548/TCP,31400:30295/TCP,15443:30456/TCP   8m29s
service/istiod                 ClusterIP      10.32.0.196             15010/TCP,15012/TCP,443/TCP,15014/TCP                                        8m51s

NAME                                   READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/istio-egressgateway    1/1     1            1           8m31s
deployment.apps/istio-ingressgateway   1/1     1            1           8m31s
deployment.apps/istiod                 1/1     1            1           8m52s

NAME                                             DESIRED   CURRENT   READY   AGE
replicaset.apps/istio-egressgateway-599c8845c9   1         1         1       8m31s
replicaset.apps/istio-ingressgateway-69dc56d7f   1         1         1       8m31s
replicaset.apps/istiod-8c75fcbc9                 1         1         1       8m52s

CRD 도 함께 생성된다. 다음과 같이 확인 가능하다.

$ kubectl get crd | grep istio
authorizationpolicies.security.istio.io               2022-02-12T12:35:39Z
destinationrules.networking.istio.io                  2022-02-12T12:35:40Z
envoyfilters.networking.istio.io                      2022-02-12T12:35:40Z
gateways.networking.istio.io                          2022-02-12T12:35:40Z
istiooperators.install.istio.io                       2022-02-12T12:35:40Z
peerauthentications.security.istio.io                 2022-02-12T12:35:41Z
proxyconfigs.networking.istio.io                      2022-02-12T12:35:41Z
requestauthentications.security.istio.io              2022-02-12T12:35:41Z
serviceentries.networking.istio.io                    2022-02-12T12:35:41Z
sidecars.networking.istio.io                          2022-02-12T12:35:41Z
telemetries.telemetry.istio.io                        2022-02-12T12:35:42Z
virtualservices.networking.istio.io                   2022-02-12T12:35:42Z
wasmplugins.extensions.istio.io                       2022-02-12T12:35:42Z
workloadentries.networking.istio.io                   2022-02-12T12:35:43Z
workloadgroups.networking.istio.io                    2022-02-12T12:35:43Z

문제

이벤트(Events) 를 보면 다음과 같이 오류가 난것을 확인할 수 있다.

19m         Warning   listen tcp4 :30754: bind: address already in use   node/kworker3.systemv.local            can't open port "nodePort for istio-system/istio-ingressgateway:status-port" (:30754/tcp4), skipping it
19m         Warning   listen tcp4 :32315: bind: address already in use   node/kworker3.systemv.local            can't open port "nodePort for istio-system/istio-ingressgateway:https" (:32315/tcp4), skipping it
19m         Warning   listen tcp4 :31159: bind: address already in use   node/kworker3.systemv.local            can't open port "nodePort for istio-system/istio-ingressgateway:tcp" (:31159/tcp4), skipping it
19m         Warning   listen tcp4 :31078: bind: address already in use   node/kworker3.systemv.local            can't open port "nodePort for istio-system/istio-ingressgateway:http2" (:31078/tcp4), skipping it
19m         Warning   listen tcp4 :31384: bind: address already in use   node/kworker3.systemv.local            can't open port "nodePort for istio-system/istio-ingressgateway:tls" (:31384/tcp4), skipping it
8m58s       Warning   listen tcp4 :30051: bind: address already in use   node/kworker3.systemv.local            can't open port "nodePort for istio-system/istiod:http-monitoring" (:30051/tcp4), skipping it
8m58s       Warning   listen tcp4 :31601: bind: address already in use   node/kworker3.systemv.local            can't open port "nodePort for istio-system/istiod:https-dns" (:31601/tcp4), skipping it
8m58s       Warning   listen tcp4 :30751: bind: address already in use   node/kworker3.systemv.local            can't open port "nodePort for istio-system/istiod:https-webhook" (:30751/tcp4), skipping it
8m58s       Warning   listen tcp4 :30761: bind: address already in use   node/kworker3.systemv.local            can't open port "nodePort for istio-system/istiod:grpc-xds" (:30761/tcp4), skipping it
32m         Warning   FailedCreate                                       replicaset/productpage-v1-65b75f6885   Error creating: Internal error occurred: failed calling webhook "namespace.sidecar-injector.istio.io": failed to call webhook: Post "https://istiod.istio-system.svc:443/inject?timeout=10s": context deadline exceeded
35m         Warning   FailedCreate

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다