DEV Community

Thomas Kim
Thomas Kim

Posted on

2 2

AWS EKS에 Istio 설치 및 설정

Istio를 설치하는 방법은 istioctl, helm, Istio Operator 등 다양한 방법이 있다. 이 중 현재 운영환경에서 권장되는 방법은 모든 configuration을 IstioOperator CR 로 작성하여 이를 istioctl install command 로 적용하는 방법이다.

istioctl 설치

우선 최신버전의 istioctl을 다운로드 받고 path 에 넣어준다.

$ curl -sL https://istio.io/downloadIstioctl | sh -
$ cp ~/.istioctl/bin/istioctl ~/bin
Enter fullscreen mode Exit fullscreen mode

만약 특정 버전의 Istio 를 다운로드 받고 싶다면

$ curl -sL https://istio.io/downloadIstioctl | ISTIO_VERSION=1.10.3 TARGET_ARCH=x86_64 sh -
Enter fullscreen mode Exit fullscreen mode

Istio 설치

이제 아래와 같이 istio-operator.yaml 파일을 생성한다.

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: 2
    ingressGateways:
    - name: istio-ingressgateway
      enabled: true
      k8s:
        hpaSpec:
          minReplicas: 2
    pilot:
      enabled: true
      k8s:
        hpaSpec:
          minReplicas: 2
  meshConfig:
    enableTracing: true
    defaultConfig:
      holdApplicationUntilProxyStarts: true
    accessLogFile: /dev/stdout
    outboundTrafficPolicy:
      mode: REGISTRY_ONLY
Enter fullscreen mode Exit fullscreen mode
  • 가장 기본적인 default profile 을 사용한다.
  • 모든 component의 minReplicas를 2로 설정하여 HA를 보장하고 PodDisruptionBudget 으로 인해 istio 버전 upgrade 가 실패하는걸 막는다
  • enableTracing 을 설정하여 추후에 Datadog 이나 Jaeger 를 통해 distributed tracing 이 가능하게 한다.
  • holdApplicationUntilProxyStarts 설정으로 istio-proxy 가 완전히 올라오면 서비스가 되게 한다. (Java 같은 경우는 서비스가 올라가는게 한참 걸려서 상관없지만 Go, Python 같은 경우 먼저 올라가서 서비스가 가능한 상태가 먼저 되고 request를 받으려고 하지만 istio-proxy가 준비되지 않아 request가 실패하는 경우가 있다. 물론 deployment 의 readiness/liveness 설정으로 대부분 istio-proxy 가 먼저 뜨지만 로컬에서 개발할때는 빠르게 테스트 하기 위해 readiness/liveness 없이 하기도 한다)
  • accessLogFile 설정으로 Envoy proxy 의 access log를 콘솔로 남긴다.
  • outboundTrafficPolicy 설정을 REGISTRY_ONLY 로 하여 오직 ServiceEntry 를 통해 허가된 IP/Domain 만 outbound를 허용한다. (이 설정은 개발중에 좀 성가실 수 있다... 하지만 개발을 완료한 후에 적용하려 하면 더욱 힘들고 결국 해당 설정 없이 서비스 하게 되는 경우도 있다) 이를 통해 더욱 secure 한 서비스를 만들 수 있다. (default 설정은 ALLOW_ANY 이다)

아래와 같이 kubernetes 에 istio를 deploy 한다.

$ istioctl install -f istio-operator.yaml
Enter fullscreen mode Exit fullscreen mode

이제 Kubernetes 에 Istio 가 배포 되었다. 아래와 같이 확인한다.

$ kubectl get pods -n istio-system
Enter fullscreen mode Exit fullscreen mode

Namespace lable 을 통한 auto injection 설정

마지막으로 원하는 namespace, 보통 default namespace 에 아래와 같이 label을 추가해서 Istio 가 자동으로 application 을 배포할 때 Envoy sidecar proxy를 주입하도록 설정한다.

$ kubectl label namespace default istio-injection=enabled
Enter fullscreen mode Exit fullscreen mode

이제 default namespace 에 배포하는 서비스에는 istio-proxy가 sidecar 로 같이 올라가서 traffic management, security 등 다양한 Istio 의 기능을 사용할 수 있게 되었다.

Heroku

Simplify your DevOps and maximize your time.

Since 2007, Heroku has been the go-to platform for developers as it monitors uptime, performance, and infrastructure concerns, allowing you to focus on writing code.

Learn More

Top comments (0)

Some comments have been hidden by the post's author - find out more

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more