본문 바로가기
K8S

[kubernetes] kind 명령어 정리

by Rainbound-IT 2025. 9. 6.
반응형

📌 클러스터 관리

# 클러스터 생성 (단일 노드)
kind create cluster --name my-cluster

# 설정파일로 클러스터 생성 (멀티노드, 포트매핑 등)
kind create cluster --config kind-config.yaml

# 생성된 클러스터 목록 확인
kind get clusters

# 클러스터 삭제
kind delete cluster --name my-cluster


📌 노드 관리

# 클러스터 노드 보기
kubectl get nodes

# 특정 클러스터의 노드 확인
kind get nodes --name my-cluster

# 클러스터 노드에 직접 접속
docker exec -it my-cluster-control-plane bash


📌 이미지 관리

# 로컬 도커 이미지 → kind 클러스터에 로드
kind load docker-image myapp:latest --name my-cluster

# 외부 레지스트리에서 pull 불가할 때 로컬 빌드 후 위 명령어로 주입


📌 kubeconfig 관련

# 현재 클러스터 정보 확인
kubectl cluster-info --context kind-my-cluster

# 컨텍스트 확인
kubectl config get-contexts

# 컨텍스트 전환
kubectl config use-context kind-my-cluster


📌 디버깅 & 실습

# 전체 리소스 확인
kubectl get all -A

# 간단한 nginx 배포
kubectl create deployment web --image=nginx
kubectl expose deployment web --port=80

# 포트포워딩 (로컬 8080 → Pod 80)
kubectl port-forward deploy/web 8080:80

# Ingress-nginx 설치 (kind용 매니페스트)
kubectl apply -f <https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yaml>


📌 클러스터 점검

# 노드 상태 확인
kubectl get nodes -o wide

# 파드 상태 확인
kubectl get pods -A

# 이벤트 보기
kubectl get events -A --sort-by='.lastTimestamp'

# 특정 파드 로그 보기
kubectl logs -f pod-name -n namespace

 

반응형

댓글