istio 문서 참고
curl -L https://istio.io/downloadIstio | sh -
cd istio-1.19.1
export PATH=$PWD/bin:$PATH
[devops@ip ~]$ curl -L https://istio.io/downloadIstio | sh -
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 101 100 101 0 0 313 0 --:--:-- --:--:-- --:--:-- 313
100 4899 100 4899 0 0 14637 0 --:--:-- --:--:-- --:--:-- 14637
Downloading istio-1.19.1 from https://github.com/istio/istio/releases/download/1.19.1/istio-1.19.1-linux-amd64.tar.gz ...
Istio 1.19.1 Download Complete!
Istio has been successfully downloaded into the istio-1.19.1 folder on your system.
Next Steps:
See https://istio.io/latest/docs/setup/install/ to add Istio to your Kubernetes cluster.
To configure the istioctl client tool for your workstation,
add the /home/devops/istio-1.19.1/bin directory to your environment path variable with:
export PATH="$PATH:/home/devops/istio-1.19.1/bin"
Begin the Istio pre-installation check by running:
istioctl x precheck
Need more information? Visit https://istio.io/latest/docs/setup/install/
[devops@ip~]$ cd istio-1.19.1
[devops@ip~ istio-1.19.1]$ export PATH=$PWD/bin:$PATH
istio profile list
[devops@ip ~]$ istioctl profile list
Istio configuration profiles:
ambient
default
demo
empty
external
minimal
openshift
preview
remote
istioctl install --set profile=demo
위 명령어로 바로 준비된 profile 을 사용하여 설치할 수 있지만 yaml 파일을 사용하여 설치 진행 하겠다.
[devops@~ istio-1.18.2]$ istioctl operator init
Installing operator controller in namespace: istio-operator using image: docker.io/istio/operator:1.18.2
Operator controller will watch namespaces: istio-system
✔ Istio operator installed
✔ Installation complete
istio-operator.yaml
apiVersion: install.istio.io/v1alpha1
kind: IstioOperator
metadata:
namespace: istio-system
name: istiocontrolplane
spec:
profile: default # production 환경에 적합
components:
egressGateways:
- name: istio-egressgateway
enabled: true
k8s:
hpaSpec:
minReplicas: 2 # HA를 보장하고 PodDisruptionBudget 으로 인해 istio 버전 upgrade 가 실패하는걸 막는다
ingressGateways:
- name: istio-ingressgateway
enabled: true
k8s:
hpaSpec:
minReplicas: 2
pilot:
enabled: true
k8s:
hpaSpec:
minReplicas: 2
meshConfig:
enableTracing: true # Datadog 통해 distributed tracing 가능하도록 설정
defaultConfig:
holdApplicationUntilProxyStarts: true # istio-proxy 가 완전히 올라오면 서비스가 되게 한다.
accessLogFile: /dev/stdout # Envoy proxy 의 access log를 콘솔로 남긴다.
outboundTrafficPolicy:
mode: ALLOW_ANY # 테스트 환경으로 outbound 모두 허용
[devops@~ istio]$ istioctl install -f istio-operator.yaml
This will install the Istio 1.18.2 default profile with ["Istio core" "Istiod" "Ingress gateways" "Egress gateways"] components into the cluster. Proceed? (y/N) y
✔ Istio core installed
✔ Istiod installed
✔ Egress gateways installed
✔ Ingress gateways installed
✔ Installation complete Making this installation the default for injection and validation.
dev namepsace istio injenction 추가
[devops@~ istio]$ kubectl label namespace dev istio-injection=enabled
namespace/dev labeled
우리는 istio-ingressgateway 컴퍼넌트로 자동생성된 clb 를 사용하지 않고 aws-loadbalancer-controller alb 를 생성하여 연동할 예정이기 때문에 ingressGateways 서비스 타입을 nodePort 로 변경한다
[devops@ip~ istio]$ kubectl get service istio-ingressgateway -n istio-system -o jsonpath='{.spec.ports[?(@.name=="status-port")].nodePort}'
31925
...
ingressGateways:
- name: istio-ingressgateway
enabled: true
k8s:
hpaSpec:
minReplicas: 2
service:
type: NodePort # ingress gateway 의 NodePort 사용
serviceAnnotations: # Health check 관련 정보
alb.ingress.kubernetes.io/healthcheck-path: /health
alb.ingress.kubernetes.io/healthcheck-
...
k8s ingress 오브젝트를 사용하여 ALB 생성
테스트 환경으로 인증서는 생략
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress-alb
namespace: istio-system
annotations:
kubernetes.io/ingress.class: alb
alb.ingress.kubernetes.io/subnets: [subnet-01], [subnet-02]
alb.ingress.kubernetes.io/scheme: internal
alb.ingress.kubernetes.io/load-balancer-name: devops-test-ingress-alb
spec:
rules:
- http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: istio-ingressgateway
port:
number: 80
[devops@~ istio]$ k apply -f kube-ingress.yaml
Warning: annotation "kubernetes.io/ingress.class" is deprecated, please use 'spec.ingressClassName' instead
ingress.networking.k8s.io/ingress-alb created
참조
https://devocean.sk.com/blog/techBoardDetail.do?ID=163655