비전공자도 이해할 수 있는 쿠버네티스 입문/실전
summary-kubernetes-commands-2
파드(Pod) 관련 명령어
✅ 파드 조회
$ kubectl get pods
✅ 파드 내부로 접속
# kubectl exec -it [파드명] -- bash
$ kubectl exec -it nginx-pod -- bash
✅ 파드 포트 포워딩
# kubectl port-forward pod/[파드명] [로컬에서의 포트]/[파드에서의 포트]
$ kubectl port-forward pod/nginx-pod 80:80
✅ 파드 삭제
# kubectl delete pod [파드명]
$ kubectl delete pod nginx-pod # nginx-pod라는 파드 삭제
디플로이먼트(Deployment) 관련 명령어
✅ 디플로이먼트 조회
$ kubectl get deployment
✅ 디플로이먼트 삭제
# kubectl delete deployment [디플로이먼트명]
$ kubectl delete deployment spring-deployment # spring-deployment라는 디플로이먼트 삭제
서비스(Service) 관련 명령어
✅ 서비스 조회
$ kubectl get service
✅ 서비스 삭제
# kubectl delete service [서비스명]
$ kubectl delete service spring-service # spring-service라는 서비스 삭제
공통 명령어
✅ 매니페스트 파일에 적혀져있는 리소스(파드 등) 생성
# kubectl apply -f [파일명]
$ kubectl apply -f nginx-pod.yaml
✅ 모든 리소스 삭제
$ kubectl delete all --all