Kind 는 로컬 컴퓨터 환경에 쿠버네티스 클러스터를 손쉽고 빠르게 설치 하기 위해 만들어진 도구입니다.
Kind는 Go 언어를 기반으로 만들어 졌으며, Docker 이미지를 기반으로 kubeadm을 이용하여 클러스터를 배포 합니다.
kind 공식 홈페이지 : kind.sigs.k8s.io
설치 가이드 원본 URL : https://kind.sigs.k8s.io/docs/user/quick-start/#installation
brew install kind
choco install kind
curl.exe -Lo kind-windows-amd64.exe https://kind.sigs.k8s.io/dl/v0.15.0/kind-windows-amd64
Move-Item .\kind-windows-amd64.exe c:\some-dir-in-your-PATH\kind.exe
choco install kubectx
choco install kubens
kind create cluster # Default cluster context 이름은 'kind' 로 생성
kind create cluster --name dangtong # cluster context 이름을 'dangtong' 으로 지정
kind get clusters
kubectl cluster-info --context dangtong
kind delete cluster
kind delete clusters kind-local-cluster
설정파일을 이용해서 kind 클러스터를 생성할 수 있습니다.
kind create cluster --config kind-example-config.yaml
3개 노드(1 controller, 2worker) 클러스터 설정
# three node (two workers) cluster config
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
- role: worker
- role: worker
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
- role: control-plane
- role: control-plane
- role: worker
- role: worker
- role: worker
쿠버네티스 버전에 따른 이미지는 링크에서 확인 가능 : https://github.com/kubernetes-sigs/kind/releases
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
image: kindest/node:v1.16.4@sha256:b91a2c2317a000f3a783489dfb755064177dbc3a0b2f4147d50f04825d016f55
- role: worker
image: kindest/node:v1.16.4@sha256:b91a2c2317a000f3a783489dfb755064177dbc3a0b2f4147d50f04825d016f55
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
networking:
podSubnet: "10.244.0.0/16"
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
networking:
serviceSubnet: "10.96.0.0/12"
Caliaco 완 같은 3rd party CNI 사용을 위해서는 default CNI 설치를 하지 말아야 합니다.
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
networking:
# default CNI가 설치 되지 않습니다.
disableDefaultCNI: true
iptables 또는 IPVS 중에 선택해서 사용 가능. default 는 iptables
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
networking:
kubeProxyMode: "ipvs"
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
name: cwave-cluster
nodes:
- role: control-plane
kubeadmConfigPatches:
- |
kind: InitConfiguration
nodeRegistration:
kubeletExtraArgs:
node-labels: "ingress-ready=true"
image: kindest/node:v1.29.4
extraPortMappings:
- containerPort: 80
hostPort: 80
protocol: TCP
- containerPort: 443
hostPort: 443
protocol: TCP
- role: worker
image: kindest/node:v1.29.4
- role: worker
image: kindest/node:v1.29.4
networking:
serviceSubnet: "10.120.0.0/16"
podSubnet: "10.110.0.0/16"
# 생성
kind create cluster --config ./3-node-cluster.yaml
# 삭제
kind delete cluster --name cwave-cluster
kind get kubeconfig --internal --name cwave-cluster