시나브로

[패캠][실전 DevOps 환경의 Kubernetes 완벽 마스터] - 2-4. pod, namespace, deployment 등 오브젝트 활용하기 본문

Cloud/Kubernetes

[패캠][실전 DevOps 환경의 Kubernetes 완벽 마스터] - 2-4. pod, namespace, deployment 등 오브젝트 활용하기

sa1347 2026. 10. 3. 22:13

create namespace

 

get ns

 

kubectl get pods -n product

namespace만 만들었으니 당연히 pod 조회 안됨

 

 

kubectl run webserver -n product --image nginx:1.14

product라는 namespace에 webserver라는 nginx1.14버전 이미지를 가진 pod를 실행해라

 

 

kubectl get pods -n product

ContainerCreating 컨테이너 생성 중

 

 

kubectl delete pod webserver -n product

1. product라는 namespace에 webserver라는 pod를 삭제해라

2. 삭제 후 pod 없는 상태 확인

 

kubectl run webserver --image nginx:1.14  --port 80 --dry-run=client -o yaml > test.yaml

1. nginx 1.14 이미지로, 80번 port를 쓰는 webserver라는 pod 1개를 만드는데,

2. 실제로 만들지는 말고 (yaml로 뽑아서) test.yaml 파일에 저장해라

test.yaml 확인

 

kubectl apply -f test.yaml

test.yaml 적용

 

kubectl create deployment weplat --image=nginx:1.14 --replicas=2 --dry-run=client -o yaml > deployment-1.yaml

1. nginx 1.14 이미지로 pod 2개의 weplat deployment를 만드는데,

2. 실제로 만들지는 말고 (yaml로 뽑아서) deployment-1.yaml 파일에 저장해라

 

1. deployment-1.yaml 적용

2. weplat pod 실행 중 확인

 

 

kubectl get all

object 전체 확인

 

1. bespin이라는 deployment의 pod 개수를 3개로 맞춰라

2. no objects passed to scale - 확장할 대상으로 넘겨받은 오브젝트가 없다.

3. apps 그룹에 속한, nginx라는 deployment에 "변경 이유: version 1.15" 메모(annotate)를 붙여라

4. nginx라는 deployments를 찾을수없다.