📌 1. Deployment란 무엇인가요?

Deployment는 Kubernetes에서 Pod를 안정적으로 관리하고, 업데이트·롤백 등을 가능하게 하는 고수준 리소스입니다.


🛠️ 2. 실습 예제: Nginx Deployment 생성

🧪 예제: nginx-deployment.yaml 작성

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
  labels:
    app: nginx
spec:
  replicas: 3  # ➕ Pod 3개 생성
  selector:
    matchLabels:
      app: nginx
  template:  # Pod 템플릿
    metadata:
      labels:
        app: nginx
    spec:
      containers:
        - name: nginx-container
          image: nginx:latest
          ports:
            - containerPort: 80

▶️ 실행 절차

  1. 배포 생성:
kubectl apply -f nginx-deployment.yaml

  1. Deployment 확인:
kubectl get deployments

  1. ReplicaSet 확인:
kubectl get rs

  1. Pod 상태 확인:
kubectl get pods

  1. 배포 업데이트 (Rolling Update):
kubectl set image deployment/nginx-deployment nginx-container=nginx:1.25

  1. 롤백 (되돌리기):