KIND란?
kind
kind is a tool for running local Kubernetes clusters using Docker container “nodes”. kind was primarily designed for testing Kubernetes itself, but may be used for local development or CI. If you have go 1.16+ and docker, podman or nerdctl installed go
kind.sigs.k8s.io
KIND (Kubernetes IN Docker)는 Docker 컨테이너를 사용하여 로컬 Kubernetes 클러스터를 실행하기 위한 도구입니다. 주로 Kubernetes 자체 테스트 및 로컬 개발 환경에서 사용됩니다.
주요 특징:
- 빠른 설치: Docker만 있으면 쉽게 설치 가능
- 경량화: 리소스 사용이 적어 개발 머신에 적합
- 다중 노드 지원: 여러 노드로 구성된 클러스터 생성 가능
- 구성 가능성: YAML 파일을 통해 클러스터 구성 커스터마이징 가능
- CI/CD 통합: 지속적 통합 및 배포 파이프라인에 사용 가능
- 크로스 플랫폼: Linux, macOS, Windows에서 작동
Installation and usage
For more detailed instructions see the user guide.
You can install kind with go install sigs.k8s.io/kind@v0.26.0 (for go 1.17+). This will put kind in $(go env GOPATH)/bin. You may need to add that directory to your $PATH as shown here if you encounter the error kind: command not found after installation.
To use kind, you will also need to install docker.
Once you have docker running you can create a cluster with:
kind create cluster
|
To delete your cluster use:
kind delete cluster
|
To create a cluster from Kubernetes source:
- ensure that Kubernetes is cloned in $(go env GOPATH)/src/k8s.io/kubernetes
- build a node image and create a cluster with
kind build node-image
kind create cluster --image kindest/node:latest |
Multi-node clusters and other advanced features may be configured with a config file, for more usage see the user guide or run kind [command] --help
Docker Desktop vs KIND
Docker Desktop의 내장 Kubernetes와 KIND의 주요 차이점은 다음과 같습니다:
- 설치 및 관리:
- Docker Desktop: 쉬운 원클릭 설치, GUI로 관리
- KIND: 명령줄 도구, 별도 설치 필요
- 리소스 사용:
- Docker Desktop: 더 많은 시스템 리소스 사용
- KIND: 상대적으로 가벼움, 리소스 사용 적음
- 다중 클러스터:
- Docker Desktop: 단일 클러스터만 지원
- KIND: 여러 클러스터 동시 운영 가능
- 구성 유연성:
- Docker Desktop: 제한된 구성 옵션
- KIND: YAML 파일로 상세 구성 가능
- 버전 관리:
- Docker Desktop: Kubernetes 버전 선택 제한적
- KIND: 다양한 Kubernetes 버전 지원
- 노드 구성:
- Docker Desktop: 단일 노드 클러스터
- KIND: 다중 노드 클러스터 구성 가능
실습
# two node (one workers) cluster config
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
- role: worker
extraPortMappings:
- containerPort: 31000
hostPort: 31000
listenAddress: "0.0.0.0" # Optional, defaults to "0.0.0.0"
protocol: tcp # Optional, defaults to tcp
- containerPort: 31001
hostPort: 31001
labels:
tier: backend
- role: worker
labels:
tier: frontend
KIND에서는 간단한 설정으로 Multi Node를 가진 클러스터를 생성할 수 있다.
role에 의해 하나의 노드가 추가되고, 특별히 설정을 추가하지 않아도 생성이 가능하다.
CLUSTERNAME=myk8s
kind create cluster --config kind-2node.yaml --name $CLUSTERNAME
kind create cluster 명령어로 myk8s라는 이름의 클러스터가 생성 되었습니다.
$ kind get clusters
myk8s
$ kind get nodes --name $CLUSTERNAME
myk8s-worker
myk8s-control-plane
# 삭제는 다음 명령어로 실행합니다.
$ kind delete cluster --name $CLUSTERNAME
클러스터 이름에 Node 가 덧붙여져 생성된 것을 확인했습니다.
$ kubectl get nodes -o wide
NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME
myk8s-control-plane Ready control-plane 3m v1.31.0 172.18.0.4 <none> Debian GNU/Linux 12 (bookworm) 6.6.26-linuxkit containerd://1.7.18
myk8s-worker Ready <none> 2m50s v1.31.0 172.18.0.3 <none> Debian GNU/Linux 12 (bookworm) 6.6.26-linuxkit containerd://1.7.18
myk8s-worker2 Ready <none> 2m50s v1.31.0 172.18.0.2 <none> Debian GNU/Linux 12 (bookworm) 6.6.26-linuxkit containerd://1.7.18
-o wide 파라미터를 추가하여 상세하게 살펴 볼 수 있습니다.
그런데 myk8s-worker의 ROLES가 <none> 으로 나오는게 신경 쓰이네요.
버전은 v1.31.0 최신 버전을 사용하게 됩니다.

https://kubernetes.io/ko/releases/
https://kubernetes.io/ko/releases/ 에서 확인 가능합니다.
물론 아래와 같이 image 값을 지정해 특정 버전을 사용하는 것도 가능합니다. 관련 링크
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
노드에 대해서도 상세 내용을 보겠습니다.
$ kubectl describe node myk8s-control-plane | grep Taints
Taints: node-role.kubernetes.io/control-plane:NoSchedule
$ kubectl describe node myk8s-worker | grep Taints
Taints: <none>
$ kubectl describe node myk8s-worker | grep tier
tier=backend
다음으론 docker 커맨드를 사용하여 각 Container를 확인해 보겠습니다.
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d9c03b8f0743 kindest/node:v1.31.0 "/usr/local/bin/entr…" 9 minutes ago Up 9 minutes 127.0.0.1:57114->6443/tcp myk8s-control-plane
9395b0ebbb89 kindest/node:v1.31.0 "/usr/local/bin/entr…" 9 minutes ago Up 9 minutes myk8s-worker2
e91d394fe73e kindest/node:v1.31.0 "/usr/local/bin/entr…" 9 minutes ago Up 9 minutes 0.0.0.0:31000-31001->31000-31001/tcp myk8s-worker
# Port 확인
$ docker port myk8s-worker
31000/tcp -> 0.0.0.0:31000
31001/tcp -> 0.0.0.0:31001
# docker exec
$ docker exec -it myk8s-worker ip -br -c -4 addr
lo UNKNOWN 127.0.0.1/8
eth0@if25 UP 172.18.0.3/16
$ docker exec -it myk8s-control-plane ip -br -c -4 addr
lo UNKNOWN 127.0.0.1/8
veth1562534e@if11 UP 10.244.0.1/32
veth75235125@if11 UP 10.244.0.1/32
veth18009690@if11 UP 10.244.0.1/32
eth0@if27 UP 172.18.0.4/16
실제로 노드에 필요한 패키지를 설치하듯 exec 커맨드를 활용하여 프로세스에 접근합니다.
'Kubernetes > Tool' 카테고리의 다른 글
Kustomize (외부자료) (0) | 2025.02.28 |
---|---|
Helm (외부자료) (0) | 2025.02.27 |
(2) KIND 활용 예제 MSA 샘플 (0) | 2025.01.24 |
클러스터 설치 - kubeadm ver (0) | 2023.12.12 |
kubectl 명령어로 익히는 쿠버네티스의 주요 오브젝트 (0) | 2023.11.28 |