1 watch -d kubectl get ns,svc,deploy,rs,pods cd mkdir 7 cd 7 2 kubectl create namespace game-2048 kubectl delete deployment 2048-deployment kubectl delete service 2048-service 3 vi deployment.yaml # 1. 네임스페이스 생성 apiVersion: v1 kind: Namespace metadata: name: game-2048 --- # 2. 디플로이먼트 설정 apiVersion: apps/v1 kind: Deployment metadata: name: game-2048-deployment namespace: game-2048 # 변경된 네임스페이스 labels: app: 2048-game spec: replicas: 5 selector: matchLabels: app: 2048-game template: metadata: labels: app: 2048-game spec: containers: - name: 2048-container image: public.ecr.aws/l6m2t8p7/docker-2048:latest ports: - containerPort: 80 --- # 3. 서비스 설정 apiVersion: v1 kind: Service metadata: name: game-2048-service namespace: game-2048 # 변경된 네임스페이스 spec: ports: - port: 80 targetPort: 80 protocol: TCP selector: app: 2048-game type: LoadBalancer kubectl apply -f deployment.yaml 4 # 특정 네임스페이스의 파드 확인 kubectl get pods -n game-2048 # 서비스 주소(LoadBalancer IP) 확인 kubectl get svc -n game-2048 5 kubectl config set-context --current --namespace=game-2048