kind는 도커 컨테이너 “노드”를 사용하여 로컬 쿠버네티스 클러스터를 실행하는 도구다. VMware Workstation 16 Player에 이 kind를 윈도우 환경에서 손쉽게 사용할 수록 해주는 기능이 추가되었다. 이를 활용해서 손쉽게 쿠버네티스 클러스터를 만드는 방법에 대해서 알아보도록 하겠다.
왜 VMware Workstation 16 Player를 사용하는가?
Docker Desktop for Windows, WSL 등을 활용해서 컨테이너 환경을 만드는 방법이 있다. 그럼에도 불구하고 VMware Workstation 16 Player라는 프로그램을 설치하고 vctl이라는 낯선 명령어를 사용하는 이유는 무엇을까?
쉽게 돈 때문이다. 다음 두가지 이유 때문이다.
- Windows Home 버전에는 Hyper-V 라이센스가 포함되어 있지 않다.
- VMware Workstation 16 Player는 무료다.
vctl 명령어
vctl은 VMware Workstation 16 Player에 새로 추가된 기능이다. Player를 설치하고 나면 시작 메뉴에서 다음과 같은 바로가기가 추가된 것을 볼 수 있다.
“Command Prompt for vctl”을 선택하면 명령어 창이 열리면서 그림과 같은 도움말이 표시된다.
( 사실 설치 과정에서 PATH가 설정되기 때문에 일반 명령어 창에서도 vctl 명령은 사용할 수 있다. )
kind를 위한 컨테이너 엔진 준비
vctl 명령어 사용중에 윈도우 사용자의 권한상승 요청과 관련해서 그림과 같은 대화상자가 표시되기도 한다. “예“를 클릭하면 된다.
- vctl system start 명령으로 컨테이너 엔진을 시작한다.
C:\Program Files (x86)\VMware\VMware Player\bin>vctl system start Preparing storage... Container storage has been prepared successfully under C:\Users\ikhwan.koo\.vctl\storage Preparing container network... Container network has been prepared successfully using vmnet: vmnet8 Launching container runtime... Container runtime has been started. C:\Program Files (x86)\VMware\VMware Player\bin>
- vctl system info 명령으로 현재 컨테이너 시스템 정보를 확인해볼 수 있다.
C:\Program Files (x86)\VMware\VMware Player\bin>vctl system info Container runtime is running. Use 'vctl system stop' to stop. Container runtime path: C:\Program Files (x86)\VMware\VMware Player\containerd.exe Process ID: 17168 Log file: C:\Users\ikhwan.koo\.vctl\containerd.log Log level: info Config: C:\Users\ikhwan.koo\.vctl\config.toml Virtual machine CPU (cores): 4 Virtual machine memory (MB): 4096 Kubernetes node CPU (cores): 2 Kubernetes node memory (MB): 2048 Host network: vmnet8 Storage root folder: C:\Users\ikhwan.koo\.vctl\storage C:\Program Files (x86)\VMware\VMware Player\bin>
vctl kind 명령을 실행한다. 처음 kind를 사용하는 경우에는 kind 사용에 필요한 파일들이 다운로드 된다. 이들 파일은 사용자 디렉토리의 아래에 .vctl\bin에 저장된다.
C:\Program Files (x86)\VMware\VMware Player\bin>vctl kind Downloading 3 files... Downloading [crx.vmdk 88.08% kubectl.exe 52.10% kind-windows-amd64 0.71%] Finished crx.vmdk 100.00% Finished kubectl.exe 100.00% Downloading [kind-windows-amd64 100.00%] Finished kind-windows-amd64 100.00% 3 files successfully downloaded. C:\Program Files (x86)\VMware\VMware Player\bin>
저장이 완료되면 명령어 창이 하나 더 열린다. 이 창에서 kind 명령을 사용하면 된다.
kind 파일들이 한번 다운로드 된 이후에는 vctl kind를 입력하면 바로 명령어 창이 하나 더 열리게 되고, 여기서 kind 관련 작업을 진행하면 된다.
kind 사용
현재 Player에서 설치되는 버전은 0.8.1이고, vtcl 환경 특성상 kind build, kind export logs 명령은 지원하지 않는다.
C:\Program Files (x86)\VMware\VMware Player\bin>kind -h kind creates and manages local Kubernetes clusters using Docker container 'nodes' Usage: kind [command] Available Commands: build Build one of [node-image] completion Output shell completion code for the specified shell (bash, zsh or fish) create Creates one of [cluster] delete Deletes one of [cluster] export Exports one of [kubeconfig, logs] get Gets one of [clusters, nodes, kubeconfig] help Help about any command load Loads images into nodes version Prints the kind CLI version Flags: -h, --help help for kind --loglevel string DEPRECATED: see -v instead -q, --quiet silence all stderr output -v, --verbosity int32 info log verbosity --version version for kind Use "kind [command] --help" for more information about a command. C:\Program Files (x86)\VMware\VMware Player\bin>
- kind create cluster 명령으로 클러스터를 생성한다.
C:\Program Files (x86)\VMware\VMware Player\bin>kind create cluster Creating cluster "kind" ... • Ensuring node image (kindest/node:v1.18.2) 🖼 ... ✓ Ensuring node image (kindest/node:v1.18.2) 🖼 • Preparing nodes 📦 ... ✓ Preparing nodes 📦 • Writing configuration 📜 ... ✓ Writing configuration 📜 • Starting control-plane 🕹️ ... ✓ Starting control-plane 🕹️ • Installing CNI 🔌 ... ✓ Installing CNI 🔌 • Installing StorageClass 💾 ... ✓ Installing StorageClass 💾 Set kubectl context to "kind-kind" You can now use your cluster with: kubectl cluster-info --context kind-kind Thanks for using kind! 😊 C:\Program Files (x86)\VMware\VMware Player\bin>
- kind get 명령도 잘 동작한다.
C:\Program Files (x86)\VMware\VMware Player\bin>kind get clusters kind C:\Program Files (x86)\VMware\VMware Player\bin>kind get nodes kind-control-plane C:\Program Files (x86)\VMware\VMware Player\bin>kind get kubeconfig apiVersion: v1 clusters: - cluster: certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUN5RENDQWJDZ0F3SUJBZ0lCQURBTkJna3Foa2lHOXcwQkFRc0ZBREFWTVJNd0VRWURWUVFERXdwcmRXSmwKY201bGRHVnpNQjRYRFRJd01UQXdNakF5TXpJME0xb1hEVE13TURrek1EQXlNekkwTTFvd0ZURVRNQkVHQTFVRQpBeE1LYTNWaVpYSnVaWFJsY3pDQ0FTSXdEUVlKS29aSWh2Y05BUUVCQlFBRGdnRVBBRENDQVFvQ2dnRUJBTkh3Cmh6M1NhRHVzNmR3N2xuSkdyNHRYUmE5N3pYS0I2SzlHSWhpNUE0QU1QQyswVy9hSXhvMTBLYmtWYWZiQklzWU4KSGFOdUE4Mm00NnRkbTA4S2FrMWdSckR5cnNwWURtTW9reDF6bmxjQ3l6Q2N5WldaY2ozUUVETFpPY25hbzhYbgpuNnFRZlFtTERGVXJJclhpOGZYSEMxa2o2dnlDS2NCKzdOOHlkcnJycUNac3dEU09XRWl0UTlTQmNuVVdaTlNrCkdOZzgwRDlFTjJrZkw2eDduVk53UWlIemVrTUkwVXg5citFVXJ3UG1EZzgxWVpiMktoQU1la25mQUZ2Sk4zeVYKeWY4S1R5dzh4R1daQXhqR2Y2VDE4RG5mczVzRlFIMjBNNGM3a24wMkVVdElMWDg3UUp2Rm5zY2MwWWxMbmpUTQpqcWFIZmp2M1R5QS9oL1ZNRHFNQ0F3RUFBYU1qTUNFd0RnWURWUjBQQVFIL0JBUURBZ0trTUE4R0ExVWRFd0VCCi93UUZNQU1CQWY4d0RRWUpLb1pJaHZjTkFRRUxCUUFEZ2dFQkFKWm04b3owa3hCVWNWcCtIcndIanJYNnBLZTUKaTlURnVyUk5NM2tUK2s1dmlUaGhkbzlsb3dMSEhTblNvYndPSVNKZ0ZSUTF4cmNWdkI1UFNDMzExYm5DN1IzSgpXdVMxbVZvbXJlL2cwcEtndVpDWmM4Q2dKNGtqZXYvWnVZc2RqOFdVUFBuOG9XNEVVVHU5VzFqcVNNeVkzNThRCjJ1K1dsa1ByN09LTUEyeTRUWG9WU0pWYkNpbHNzNDVPNmdEK0FUalBPa1B5RXkrTHpRQkQ3RGNkWTk0anNqYlQKWEpzQTJVaTJNTEFwM2Q5T0R4Y1U4S2lVcTJZL0tkQWVreTNVR3BYdHZvT2tpZnZuM21ydUtobU10MkFGWDQwZgp4aGo4VUpUT0xRc2JXUjRsUUEvNVBkbldqOHJ3UjJONXNMTDRYcXNmTlVEcTIzTjluejdEZnJlY01ndz0KLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo= server: https://127.0.0.1:52849 name: kind-kind contexts: - context: cluster: kind-kind user: kind-kind name: kind-kind current-context: kind-kind kind: Config preferences: {} users: - name: kind-kind user: client-certificate-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUM4akNDQWRxZ0F3SUJBZ0lJVDdxYURha0ZwUEF3RFFZSktvWklodmNOQVFFTEJRQXdGVEVUTUJFR0ExVUUKQXhNS2EzVmlaWEp1WlhSbGN6QWVGdzB5TURFd01ESXdNak15TkROYUZ3MHlNVEV3TURJd01qTXlORFphTURReApGekFWQ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hR3E2TnVjCnhVR0VabWNDZ1lFQXRTZzFPeCtkY0JHL1JCbCtJRE1WTDRsK2ZoZGRyZHlLUmtuL3RRckNITHFENGVSRUlkUVUKd3kzNng5bjRJdFhWRWdTbGZaM1dRem1pcVV6L1E0ME53TnVlYUpZRVFORnYxK3BlYUM2QXJUS1oza01hTkY4TAo0L2ExVTdtN2I4cno1ekdibEUzQjI1aVBYVlcyd016QW1WMkFmQjhESGtMLzEyUHVDdDlqOTZNPQotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQo= C:\Program Files (x86)\VMware\VMware Player\bin>
kind로 멀티노드 클러스터 생성
기본적으로 설치된 상태에서 kind create cluster 명령을 실행하면, control-plane 노드만 1개 구성된다. 여러노드로 구성된 클러스터를 생성하고자할 경우에는 클러스터 구성을 정의해 주어야 한다.
- kind 홈페이지의 quick-start 페이지에 있는 예제를 활용해서 멀티노드 클러스터를 생성한다.
# three node (two workers) cluster config kind: Cluster apiVersion: kind.x-k8s.io/v1alpha4 nodes: - role: control-plane - role: worker - role: worker
- kind create cluster –config d:\kind\3node.yaml 처럼 구성을 적용해서 실행한다.
C:\Program Files (x86)\VMware\VMware Player\bin>kind create cluster --config d:\kind\3node.yaml Creating cluster "kind" ... • Ensuring node image (kindest/node:v1.18.2) 🖼 ... ✓ Ensuring node image (kindest/node:v1.18.2) 🖼 • Preparing nodes 📦 📦 📦 ... ✓ Preparing nodes 📦 📦 📦 • Writing configuration 📜 ... ✓ Writing configuration 📜 • Starting control-plane 🕹️ ... ✓ Starting control-plane 🕹️ • Installing CNI 🔌 ... ✓ Installing CNI 🔌 • Installing StorageClass 💾 ... ✓ Installing StorageClass 💾 • Joining worker nodes 🚜 ... ✓ Joining worker nodes 🚜 Set kubectl context to "kind-kind" You can now use your cluster with: kubectl cluster-info --context kind-kind Have a nice day! 👋 C:\Program Files (x86)\VMware\VMware Player\bin>kind get nodes kind-control-plane kind-worker kind-worker2 C:\Program Files (x86)\VMware\VMware Player\bin>
- kubectl get nodes을 이용해서 노드 상태를 보면 다음과 같다.
C:\Program Files (x86)\VMware\VMware Player\bin>kind get nodes kind-control-plane kind-worker kind-worker2 C:\Program Files (x86)\VMware\VMware Player\bin>
- vctl ps 명령어를 실행시켜 보면 3개의 컨테이너가 동작 중임을 알 수 있다.
C:\Program Files (x86)\VMware\VMware Player\bin>vctl ps ──── ───── ─────── ── ───── ────── ───────────── NAME IMAGE COMMAND IP PORTS STATUS CREATION TIME ──── ───── ─────── ── ───── ────── ───────────── kind-control-plane kindest/node@sha256:7b27a6d0f2517ff88ba444025beae41491b016bc6af573ba467b70c5e8e0d85f /usr/local/bin/entry... 192.168.152.128 53020:6443/tcp running 2020-10-02T11:59:43+09:00 kind-worker kindest/node@sha256:7b27a6d0f2517ff88ba444025beae41491b016bc6af573ba467b70c5e8e0d85f /usr/local/bin/entry... 192.168.152.129 n/a running 2020-10-02T11:59:27+09:00 kind-worker2 kindest/node@sha256:7b27a6d0f2517ff88ba444025beae41491b016bc6af573ba467b70c5e8e0d85f /usr/local/bin/entry... 192.168.152.130 n/a running 2020-10-02T11:59:39+09:00 C:\Program Files (x86)\VMware\VMware Player\bin>
참고 사항
- vctl kind 명령이 처음 실행되면 사용자 디렉토리 아래에 .vctl 디렉토리가 만들어지고 kind.exe, kubectl.exe, crx.vmdk와 같은 파일들이 다운로드되어 설치된다. 그리고 docker.exe 명령어를 vctl.exe가 처리하게 하기 위한 심볼릭링크가 생성된다. 즉, 이후에 docker 라는 명령어를 입력하게 되면, vctl이 대신 처리하게 된다.
C:\Users\ikhwan.koo\.vctl\bin>dir C 드라이브의 볼륨에는 이름이 없습니다. 볼륨 일련 번호: 1411-E469 C:\Users\ikhwan.koo\.vctl\bin 디렉터리 2020-10-02 오전 11:19 <DIR> . 2020-10-02 오전 11:19 <DIR> .. 2020-08-19 오후 02:56 71,303,168 crx.vmdk 2020-10-02 오전 11:19 <SYMLINK> docker.exe [C:\Program Files (x86)\VMware\VMware Player\bin\vctl.exe] 2020-05-02 오전 09:14 9,773,568 kind.exe 2020-07-16 오전 03:46 44,527,104 kubectl.exe 4개 파일 125,603,840 바이트 2개 디렉터리 149,492,244,480 바이트 남음 C:\Users\ikhwan.koo\.vctl\bin>