배포 및 설정
•
Helm 레포지토리 구성
helm repo add istio https://istio-release.storage.googleapis.com/charts
helm repo update
Shell
복사
•
Istio 데몬 설치
# Namespace 생성
kubectl create namespace istio-system
# Istio 기본 차트 설치
helm install istio-base istio/base -n istio-system
# Istio 검색 차트 설치
helm install istiod istio/istiod -n istio-system
YAML
복사
•
Istio-ingress controller 생성
# Namespace 생성
kubectl create namespace istio-ingress
# Sidecar Injection ENABLE
kubectl label namespace ${사이드카가 배포될 Namespace} istio-injection=enabled
# 배포
helm install istio-ingress istio/gateway -n istio-ingress
YAML
복사
•
istio-gateway 배포
vi istio-gateway.yaml
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: my-gateway # Gateway 명
spec:
selector:
app: istio-ingress # istio-ingress controller 연계
servers:
- port:
number: 80 # 받는 포트
name: http
protocol: HTTP
hosts:
- "nginx.blue02.altair.lab" # 받는 도메인
kubectl apply -f istio-gateway.yaml
Shell
복사
•
virtualservice 배포
vi virtual-service.yaml
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: test-route # VirtualService 명
spec:
hosts:
- "nginx.blue02.altair.lab" # 받는 도메인
gateways:
- my-gateway # istio-gateway 연계
http:
- name: "nginx-v2-route"
- match:
- uri:
prefix: "/test" # 2. 특수 트래픽 경로 : /test로 들어왔을때 /error로 보낸다.
rewrite:
uri: "/error"
route:
- destination:
host: nginx-v2-service.default.svc.cluster.local # 받은 svc
port:
number: 9001 # App service port
subset: v2
- name: "nginx-v1-route" # 1. 기본 트래픽 경로
route:
- destination:
host: ngninx-v1-service.default.svc.cluster.local
subset: v1
kubectl apply -f virtual-service.yaml
! 사이트카 인젝션 허용 해놓은 namespace의 pod 재생성
https://seungjuitmemo.tistory.com/220
YAML
복사