Kubernetes Istio 설치/적용하기 (Kubernetes Istio service mesh)

2021. 11. 10. 16:39IT/Kubernetes

728x90

1. Istio 설치

 - 최신 Istio Releases를 다운로드 한다. (본문에서는 Istio 1.9.1 사용)

다운 받은 폴더로 이동 후, Istioctl 경로를 추가한다.

curl -L https://istio.io/downloadIstio | sh -
cd istio-1.9.1
export PATH=$PWD/bin:$PATH

 

 - Istio가 제공하는 profile을 확인하고, 설치한다.

istioctl profile list
istioctl install --set profile=demo -y
kubectl label namespace default istio-injection=enabled

 

2. Sample Appl. 배포

 - Istio 정상 동작을 확인하기 위해 MSA Appl.(BookInfo Appl.)을 배포한다.

Pod, Istio sidecar를 배포한다. Appl.이 정상적으로 클러스터 내에서 실행되는지 확인한다.

kubectl apply -f samples/bookinfo/platform/kube/bookinfo.yaml
kubectl get services
kubectl get pods
kubectl exec "$(kubectl get pod -l app=ratings -o jsonpath='{.items[0].metadata.name}')" -c ratings -- curl -sS
productpage:9080/productpage | grep -o "<title>.*</title>"

 

 - 외부에서 Appl.에 액세스할 수 있도록 Istio gateway를 설정하고, 구성에 문제가 있는지 확인한다. 

kubectl apply -f samples/bookinfo/networking/bookinfo-gateway.yaml
istioctl analyze

 

 - node port를 통해 통신할 수 있도록 설정하기 위해 Ingress Port를 지정한다.

export INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.
name=="http2")].nodePort}')
export SECURE_INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports
[?(@.name=="https")].nodePort}')
export INGRESS_HOST=$(kubectl get po -l istio=ingressgateway -n istio-system -o jsonpath='{.items[0].status.
hostIP}')

 

 - Gateway URL을 설정하고, 확인한다.

export GATEWAY_URL=$INGRESS_HOST:$INGRESS_PORT
echo "$GATEWAY_URL"

 

 - http://$GATEWAY_URL/productpage 에 접속하여 배포된 Appl.을 확인할 수 있다.

 

728x90

 

3. Kiali 설치

 - Kiali를 배포하고, 정상 배포가 되었는지 확인한다. (에러 1회 발생)

kubectl apply -f https://raw.githubusercontent.com/istio/istio/release-1.9/samples/addons/kiali.yaml

 

 - 외부 접속을 하기 위해 NodePort로 수정한다.

kubectl -n istio-system edit svc/kiali
- name: http-kiali
 nodePort: 30004
 port: 20001
 protocol: TCP
 targetPort: 20001
 selector:
 app: kiali
 sessionAffinity: None
 type: NodePort

 

 - http://localhost:30004/kiali/console/overview?duration=60&refresh=15000 에서 Kiali Dashboard를 확인할 수 있다.

 

참고 Link

1. https://istio.io/latest/docs/tasks/traffic-management/ingress/ingress-control/

 

Ingress Gateways

Describes how to configure an Istio gateway to expose a service outside of the service mesh.

istio.io

2. https://blog.ramjee.uk/istio-with-kubernetes/

 

istio kubernetes kiali

Using Istio as an API gateway with Kubernetes

blog.ramjee.uk

 

300x250