이스티오 샘플 코드 올리기!
Istio EKS설정의 다음 장입니다.
apiVersion: extensions/v1beta1에서 apiVersion: apps/v1으로 수정
kubectl create ns sock-shop
kubectl label namespace sock-shop istio-injection=enabled
kubectl apply -f 1-sock-shop-complete-demo-istio.yaml -n sock-shop
kubectl apply -f gw.yaml -n sock-shop
apiVersion: networking.istio.io/v1beta1
kind: Gateway
metadata:
name: sock-shop
spec:
selector:
istio: ingressgateway
servers:
- hosts:
- '*'
port:
name: http
number: 80
protocol: HTTP
kubectl apply -f vs.yaml -n sock-shop
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
name: sock-shop
spec:
gateways:
- sock-shop
hosts:
- '*'
http:
- route:
- destination:
host: front-end
port:
number: 80
모든 deploy에 istio side car를 붙히기 위해서 rollout 을 해준다.
아래와같이 pod가 2개로 변경되며 side car가 붙은 것을 알수있음.
[root@ip-10-1-8-104 1-sock-shop-install]# kubectl get pods -n sock-shop
NAME READY STATUS RESTARTS AGE
carts-64d49fb9d5-77nrv 2/2 Running 0 6m10s
carts-db-9f479f97d-dhgtl 2/2 Running 0 5m38s
catalogue-7c4b4cbb84-pspw7 2/2 Running 0 4m1s
catalogue-db-6f8f687666-8dr2j 2/2 Running 0 3m34s
front-end-786fc7f5c9-gdv5r 2/2 Running 0 3m22s
orders-84d8fd9494-snv7r 2/2 Running 0 2m51s
orders-db-7b9776477b-xbqn8 2/2 Running 0 30s
payment-6cdc5b5748-fj7zz 2/2 Running 0 2m19s
queue-master-766f48fc55-9rmcf 2/2 Running 0 2m17s
rabbitmq-59cb488f9b-6r87d 2/2 Running 0 20s
shipping-5cd48f6bb6-jcmsl 2/2 Running 0 4m33s
sidecar-test 2/2 Running 0 6m48s
user-6c659b7fc5-l4z77 2/2 Running 0 4m52s
user-db-78cc8f7b49-slrjq 2/2 Running 0 4m43s