728x90
반응형
Kubernetes IN Docker
What is KIND?
도커 컨테이너 노드를 사용하여 로컬 쿠버네티스 클러스터를 실행하는 도구
KIND의 주요 특징(출처: KIND 공식)
- 로컬 클러스터 실행
Docker 컨테이너를 노드로 사용하여, 가볍고 빠르게 클러스터 실행 가능하다. - 쿠버네티스 테스트
쿠버네티스 개발자들이 새로운 기능이나 버전을 테스트할 수 있도록 설계되었다. - CI/CD 환경 적합
빠른 클러스터 생성·삭제로 자동화된 테스트에 적합하다. - 멀티 노드 지원
여러 노드(마스터/워커)를 포함한 클러스터 구성이 가능하다. - 경량화된 환경
VM 없이 Docker만 있으면 실행 가능하다.
KIND 설치하기(출처: KIND 공식)
#KIND 설치
#curl -Lo 다운받을경로 설치URL
[root@]$ curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.11.1/kind-linux-amd64
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 97 100 97 0 0 177 0 --:--:-- --:--:-- --:--:-- 176
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 6660k 100 6660k 0 0 3333k 0 0:00:01 0:00:01 --:--:-- 80.3M
#다운받은폴더에 권한부여
[root@]$ chmod +x ./kind
#다운받은 디렉토리를 /usr/local/bin 하위로 옮긴다
#/usr/local/bin 하위로 이동시켜야 kind 커맨드가 실행된다
[root@]$ mv ./kind /usr/local/bin/kind
#kind 명령어 실행 확인
[root@]$ kind
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.
#kubectl 설치하기
#KIND는 Cluster가 생성될 때, kubectl과 연결되도록 ~/.kube/config 파일에 설정이 추가된다.
#Cluster를 설치한 후, kubectl을 설치하면 정상적으로 연결이 되지 않으므로 kubectl을 먼저 설치한다.
[root@]$ curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 138 100 138 0 0 594 0 --:--:-- --:--:-- --:--:-- 594
100 57.3M 100 57.3M 0 0 65.0M 0 --:--:-- --:--:-- --:--:-- 65.0M
#다운받은 kubectl을 /usr/local/bin 하위로 옮긴다
[root@]$ install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
[root@]$ kubectl
kubectl controls the Kubernetes cluster manager.
Find more information at: https://kubernetes.io/docs/reference/kubectl/
Basic Commands (Beginner):
create Create a resource from a file or from stdin
expose Take a replication controller, service, deployment or pod and expose it as a new Kubernetes service
run Run a particular image on the cluster
set Set specific features on objects
Basic Commands (Intermediate):
explain Get documentation for a resource
get Display one or many resources
edit Edit a resource on the server
delete Delete resources by file names, stdin, resources and names, or by resources and label selector
Deploy Commands:
rollout Manage the rollout of a resource
scale Set a new size for a deployment, replica set, or replication controller
autoscale Auto-scale a deployment, replica set, stateful set, or replication controller
Cluster Management Commands:
certificate Modify certificate resources
cluster-info Display cluster information
top Display resource (CPU/memory) usage
cordon Mark node as unschedulable
uncordon Mark node as schedulable
drain Drain node in preparation for maintenance
taint Update the taints on one or more nodes
Troubleshooting and Debugging Commands:
describe Show details of a specific resource or group of resources
logs Print the logs for a container in a pod
attach Attach to a running container
exec Execute a command in a container
port-forward Forward one or more local ports to a pod
proxy Run a proxy to the Kubernetes API server
cp Copy files and directories to and from containers
auth Inspect authorization
debug Create debugging sessions for troubleshooting workloads and nodes
events List events
Advanced Commands:
diff Diff the live version against a would-be applied version
apply Apply a configuration to a resource by file name or stdin
patch Update fields of a resource
replace Replace a resource by file name or stdin
wait Experimental: Wait for a specific condition on one or many resources
kustomize Build a kustomization target from a directory or URL
Settings Commands:
label Update the labels on a resource
annotate 자원에 대한 주석을 업데이트합니다
completion Output shell completion code for the specified shell (bash, zsh, fish, or powershell)
Subcommands provided by plugins:
Other Commands:
api-resources Print the supported API resources on the server
api-versions Print the supported API versions on the server, in the form of "group/version"
config kubeconfig 파일을 수정합니다
plugin Provides utilities for interacting with plugins
version Print the client and server version information
Usage:
kubectl [flags] [options]
Use "kubectl <command> --help" for more information about a given command.
Use "kubectl options" for a list of global command-line options (applies to all commands).
#클러스터 생성하기
#kind create cluster --name 클러스터이름
[root@]$ kind create cluster --name my-cluster
Creating cluster "my-cluster" ...
✓ Ensuring node image (kindest/node:v1.21.1) 🖼
✓ Preparing nodes 📦
✓ Writing configuration 📜
✓ Starting control-plane 🕹️
✓ Installing CNI 🔌
✓ Installing StorageClass 💾
Set kubectl context to "kind-my-cluster"
You can now use your cluster with:
kubectl cluster-info --context kind-my-cluster
Thanks for using kind! 😊
#클러스터 생성 확인하기
#kind get clusters
[root@]$ kind get clusters
my-cluster
#kubectl을 사용해 클러스터 생성 확인
[root@]$ kubectl cluster-info --context kind-my-cluster
Kubernetes control plane is running at https://127.0.0.1:42395
CoreDNS is running at https://127.0.0.1:42395/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
#리소스 생성 확인
#노드와 서비스가 1개씩 기본 생성된 것을 확인한다
[root@]$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
bxbu-control-plane Ready control-plane,master 10m v1.21.1
[root@]$ kubectl get all
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 3m27s
728x90
반응형
'클라우드' 카테고리의 다른 글
[쿠버네티스] 파드 간 호출 실패 (503 Service Unavailable) 원인과 RBAC 설정 방법 (0) | 2025.06.23 |
---|---|
[쿠버네티스] KIND 클러스터에서 로컬 이미지를 사용하고 볼륨 마운트하기 (0) | 2025.05.27 |
[도커] localhost 접근 실패 오류 해결 (1) | 2024.10.23 |
[서버/클라우드] 클라우드 서비스의 종류 (On-Premise IaaS PaaS SaaS (0) | 2023.12.10 |
댓글