Skip to content

Install Istio and uEngine cloud k8s Setting

kimhyungkook edited this page Mar 6, 2019 · 10 revisions

istio install

  • 1 helm 설치
> helm install install/kubernetes/helm/istio --name istio --namespace istio-system
  • 2 cli 설치
# 최신 버전 설치
> curl -L https://git.io/getLatestIstio | sh -
> cd istio-1.0.6

# 이전 버전 istio 설치
> curl -L https://git.io/getLatestIstio | ISTIO_VERSION=1.0.5 sh
> cd istio-1.0.5

# istioctl 을 사용할수 있도록 path 를 등록 한다.
> export PATH=$PWD/bin:$PATH

# istio 를 설치하는건 기본적으로 커스텀 리소스를 정의할수 있는 customresourcedefinition을 먼저 설치한다.
> kubectl apply -f install/kubernetes/helm/istio/templates/crds.yaml

# 그 후에 옵션별로 istio 를 인스톨 할수 있는데 그중에 TLS authentication between sidecars 할수있는 아래 옵션으로 설치한다
> kubectl apply -f install/kubernetes/istio-demo.yaml
## kubectl apply -f install/kubernetes/istio-demo-auth.yaml TLS 있는 버전은 이걸 설치

# 설치 확인

# istio 확인
> kubectl get po -n istio-system
> istioctl version

istio injection

# 기본 사용방법

> kubectl apply -f <(istioctl kube-inject -f samples/bookinfo/platform/kube/bookinfo.yaml)

위와같이 배포시 기존에 pod 의 ready 상태가 1/1 에서 2/2 로 변경되어 올라간다.
이는 하나의 pod 에 container 가 두개가 뜬다는 의미이다.
한개는 설정해 놓았던 docker image 를 가진 container 가 뜨고,
다른 하나는 istio-proxy 이름을 가진 container 가 sidecar 로 뜬다.

아래는 istio inject 된 pod 를 조회한 것이다.
container 를 확인해본다.

> kubectl get po serviceapi-5b475848b8-6hv7x -o yaml
...
containerStatuses:
  - containerID: docker://dd7e6833633d6c0a725e3e4b8666e97ed607fa4ee87xxx
    image: istio/proxyv2:1.0.5
    name: istio-proxy
    ...
  - containerID: docker://5418d1a084b41d32a6caf2058463a03cb84801a852xxxc
    image: 979050235289.dkr.ecr.ap-northeast-2.amazonaws.com/uengine/serviceapi:latest
    imageID: docker-pullable://xx.dkr.ecr.ap-northeast-
2.amazonaws.com/uengine/serviceapi@sha256:3b7d7028bbbc2c77e2a866161c33cb7aeddxx
    ...
...

# 특정 namespace 에 pod가 create 시 자동으로 inject 되도록 설정하는 auto-injection 방법

# default 네임스페이스에 istio 로 자동 injection 을 하기 위하여 아래 스크립트를 실행한다.
> kubectl label namespace default istio-injection=enabled

# 확인
> kubectl get namespace -L istio-injection
NAME            STATUS   AGE   ISTIO-INJECTION
default         Active   14d   enabled
ingress-nginx   Active   2d
istio-system    Active   1d    disabled

# 삭제
> kubectl label namespace default istio-injection-

uEngine cloud k8s 프로젝트를 istio 로 inject 하기

Clone this wiki locally