AWS EKS에 Istio 설치 및 설정
source link: https://dev.to/airoasis/ekse-istio-seolci-mic-seoljeong-2fpc
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
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
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK