[Istio] 환경 구축(feat. Minikube)
Istio
A service mesh for observability, security in depth, and management that speeds deployment cycles.
istio.io
공유 목적을 위해 istio 관련 포스팅을 진행해보려고 한다
나의 환경의 경우 mac os(M2 pro)에 minikube를 설치해서 진행하였으며
istio는 1.20, kubernetes 버전은 1.28이다.
Istio 사용이유
- Istio는 ServiceMash로 MSA 구조상 규모가 커져감에 따라 점점 복잡해지고 상호동작에 대한 이해가 어려워지면서 관리의 어려움이 발생하게되는데 이를 어느정도 해소해줄 수 있는 오픈소스이다. 사용자는 sidecar를 injection하는 것만으로 software 레벨이 아닌 인프라 레벨에서 트래픽을 관리하고 제어할 수 있다는 점이 장점이다. 그 밖에 서킷브레이킹이나 Service 라우팅을 통한 트래픽 흐름제어와 배포 관리, 가시성 확보, 분산추적, MTLS 보안 통신 등 다양한 기능을 활용할 수 있다.
minikube 설치
minikube start
minikube is local Kubernetes
minikube.sigs.k8s.io
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-darwin-amd64
sudo install minikube-darwin-amd64 /usr/local/bin/minikube
minikube start
kubectl 설치 & 자동완성설정
리눅스에 kubectl 설치 및 설정
시작하기 전에 클러스터의 마이너(minor) 버전 차이 내에 있는 kubectl 버전을 사용해야 한다. 예를 들어, v1.28 클라이언트는 v1.27, v1.28, v1.29의 컨트롤 플레인과 연동될 수 있다. 호환되는 최신 버전
kubernetes.io
kubectl Cheat Sheet
This page contains a list of commonly used kubectl commands and flags. Note: These instructions are for Kubernetes v1.28. To check the version, use the kubectl version command. Kubectl autocomplete BASH source <(kubectl completion bash) # set up autocomple
kubernetes.io
brew install kubectl
또는
brew install kubernetes-cli
alias k=kubectl
complete -o default -F __start_kubectl k
source <(kubectl completion zsh)
echo '[[ $commands[kubectl] ]] && source <(kubectl completion zsh)' >> ~/.zshrc
istioctl 설치
Getting Started
Try Istio’s features quickly and easily.
istio.io
curl -L https://istio.io/downloadIstio | sh -
cd istio-1.20.0
export PATH=$PWD/bin:$PATH
helm 설치 및 Kubernetes istio 구축
Install with Helm
Instructions to install and configure Istio in a Kubernetes cluster using Helm.
istio.io
brew install helm
helm repo add istio https://istio-release.storage.googleapis.com/charts
helm repo update
kubectl create namespace istio-system
helm install istio-base istio/base -n istio-system --set defaultRevision=default
helm ls -n istio-system
helm install istiod istio/istiod -n istio-system --wait
helm ls -n istio-system
kubectl get deployments -n istio-system --output wide
kubectl create namespace istio-ingress
helm install istio-ingress istio/gateway -n istio-ingress --wait
다른방법의 istio 구축
git clone https://github.com/DickChesterwood/istio-fleetman
cd istio-fleetman/_course_files/arm64/warmup-exercise
k apply -f 1-istio-init.yaml
k apply -f 2-istio-minikube.yaml
..
..
=> 이후 나머지 yaml도 실행시켜주면 테스트 환경을 확인할 수 있다. 아래는 Istio를 통해 구성된 service mesh를 모니터링할 수 있는 툴 kiali Dashboard의 화면이다. 참고로 해당 dashboard에 보여지려면 당연히 pod내에 envoy proxy를 sidecar형태로 injection해야하며 이는 namespace의 labeling을 통해 가능하다. 원하는 namespace에 istio-injection=enabled label을 적용하면된다. 정상적으로 injection이 되었다면 pod 생성 시(Pod내에 1개의 container를 생성했을경우) 2개의 container가 존재하는 것을 확인할 수 있으며 그중 하나는 istio-proxy(envoy proxy)이다.
Kiali Dashboard 접근
=> 하단의 Legend를 클릭하면 해당 map에 대한 정보를 볼 수 있다.
[참고] MacOS(M1, M2) minikube service type NodePort 접근이 안되는 이슈
minikube ip is not reachable
I have created one service called fleetman-webapp: apiVersion: v1 kind: Service metadata: name: fleetman-webapp spec: selector: app: webapp ports: - name: http port: 80 nodePort: ...
stackoverflow.com
Cannoot access services via NodePort on MacOS with Docker driver · Issue #11193 · kubernetes/minikube
Hello, I am facing issues accessing services via node port on Mac OS. System information: ProductName: macOS ProductVersion: 11.1 BuildVersion: 20C69 Ninikube version: minikube version: v1.19.0 com...
github.com
참고로 nodePort를 통해 Pod를 노출시키는경우 minikube ip로 접근이 안되는 이슈가 발생할 수 있다. 이는 docker를 driver로 사용하기 때문이라는 말도 있는데 어찌되었던 minikube service를 통해 간단하게 해결할 수 있다.