본문 바로가기
DevOps/Kubernetes

쿠버네티스 명령어

by 김어찐 2022. 4. 30.
728x90

현재 쿠버네티스 클러스터가 지원하는 API 리소스 목록 출력

kubectl api-resources

 

특정 API 리소스에 대해 간단한 설명 확인

kubectl explain pod[API 리소스]

 

파드 등록

kubectl apply -f pod.yaml

 

yml 삭제 및 서비스, 파드 등등 삭제

kubectl delete -f pod.yaml

kubectl delete pod hello[파드 명]

kubectl delete service hello[서비스 명]

 

모든 파드 정보

kubectl get pod -o wide

 

모든 노드 정보

kubectl get node -o wide

 

특정 파드의 정보

kubectl describe pod hello[파드]

 

특정 파드 안의 특정 컨테이너 명령어

kubectl exec -it hello[파드] -c nginx[컨테이너] sh

 

특정 파드 안의 특정 컨테이너 로그

kubectl logs hello -c nginx

전체 레플리카 셋 정보 보기

kubectl get replicasets

 

특정 레플리카 셋 정보 보기

kubectl describe replicasets [hello]

 

라벨별로 파드 보기

watch kubectl get pod --show-labels

 

실행중인 파드 정보 변경

kubectl edit pod hello-5tl7s[파드 이름]

 

파드 yml 롤링 히스토리 확인

kubectl rollout history -f rolling-update.yaml

 

롤링 버전 이동

kubectl rollout undo deployment rolling --to-revision=1

 

롤링 업데이트 상태 확인

kubectl rollout status deployment rolling[name]

 

네임스페이스 정보

kubectl get all -n a[네임스페이스]

 

노드 Lable 추가

kubectl label node minikube-m02[노드] team=red[Label]

 

노드 Lable 삭제

kubectl label node minikube-m02[노드] team-

728x90

'DevOps > Kubernetes' 카테고리의 다른 글

kubeadm reset  (0) 2022.06.10
k8s docker cgroup driver 이름 systemd로 변경  (0) 2022.06.10
k8s swap off  (0) 2022.06.10
minikube 명령어  (0) 2022.04.30
ubuntu kubectl 설치  (0) 2022.04.26