🍰kind(Kubernetes in Docker)를 사용한 k8s 테스트 환경 구성

kind is a tool for running local Kubernetes clusters using Docker container “nodes”

circle-info

kind was primarily designed for testing Kubernetes itself, but may be used for local development or CI.

kind 란?

여러 컴퓨팅 노드를 사용하는 클러스터 환경이 아닌, 단일 노드에서 쿠버네티스를 사용하고자 할 경우 여러가지 옵션이 존재합니다. 그 중 하나인 kind 는 kubernetes in docker 의 약자로서, 말 그대로 docker 환경 위에서 k8s 를 실행하는 방식을 솔루션을 의미합니다. 또한 kind 는 Kubernetes 에서 만든 솔루션이라 안정성 측면에서 유리하다고 볼 수 있습니다.

공식 문서

Single node k8s solution comparative table

-
MINIKUBE
K3S
MICROK8S
KIND

Developer

Kubernetes

Rancher

Canonical

Kubernetes

Operating systems

Windows, Linux, macOS

Windows, Linux, macOS

Windows, Linux, macOS

Windows, Linux, macOS

Commercial support

No

No

Yes

No

Installation

Very easy

Easy

Easy with Linux snap support

Easy

Multi-node clusters

Yes

Yes, but requires effort

Yes

Yes

Edge/IoT devices support

No

Yes

Yes

No

출처

Installation

1. kind 설치

운영체제 환경 별 간단한 설치 명령어를 제공하고 있으니 공식 문서를 참고 바랍니다. 아래는 몇 가지 환경에서 설치하는 방법 예시를 정리한 것이며, 주로 2-3줄의 명령어로 kind 명령어가 설치 완료됩니다.

2. cluster 설치

kind 명령어가 설치되고 나면 cluster 를 아래 명령어를 통해 쉽게 설치하고 삭제할 수 있습니다.

cluster 생성 명령어가 정상적으로 동작될 경우 환경마다 다를 수 있으나 아래와 같이 표시됩니다. 설치 전 docker 환경이 구성되어 있어야 합니다.

3. kubectl 연결

설치 안내문구에 따라 kubectl 명령어를 실행합니다. kubectl 명령어는 미리 설치되어 있다고 가정합니다. kubectl 이 바라보는 k8s 클러스터를 지정하는 명령어 입니다.

마찬가지로, 환경에 따라 다를 수 있으나, 위 명령어를 실행하면 다음과 같은 안내문구를 제공합니다.

로컬 환경에 control plane 이 설정된 것으로 확인됩니다.

Monitoring

1. docker ps

설치가 완료되면 docker 에는 다음과 같은 컨테이너가 생성되어 있습니다.

2. kubectl get all --all-namespaces

명령어를 통해 kubectl 이 가리키고 있는 k8s 정보를 확인할 수 있습니다.

참고자료

다양한 kind 활용 방법 가이드 (KR)

Last updated