IT/Kubernetes

[CKA] Deployment 란?

어린이개발자 2025. 11. 21. 13:05

이번엔 Deployment 에 대해 정리하고자 한다.

 

1. 정의

- 애플리케이션 배포를 선언적으로 관리하는 최상위 컨트롤러

- ReplicaSet 을 생성, 관리하고 Pod 배포/업데이트 전략까지 모두 담당하는 리소스

 

2. 특징

- ReplicaSet 자동 관리

- 롤링 업데이트 지원

- 쉽게 롤백 가능

- 선언적 관리

  > yaml 파일에 원하는 상태 정의를 해두어 쿠버네티스가 현재 상태를 자동으로 조정

 

3. 관련 문제 (KodeKloud 에서 제공하는 샘플 문제를 정리)

- How many Deployments exist on the system?

  > In the current(default) namespace.

kubectl get deployment

 

- What is the image used to create the pods in the new deployment?

kubectl describe deployment

 

- Create a new Deployment using the deployment-definition-1.yaml file located at /root/.

  > There is an issue with the file, so try to fix it.

kubectl explain deployment | head -n3
(deployment-definition-1.yaml 파일 수정 후) kubectl create -f /root/deployment-definition-1.yaml

 

- Create a new Deployment with the below attributes using your own deployment definition file.

  > Name: httpd-frontend; Replicas: 3; Image: httpd:2.4-alpine

vi deployment-definition-httpd.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: httpd-frontend
spec:
  replicas: 3
  selector:
    matchLabels:
      name: httpd-frontend
  template:
    metadata:
      labels:
        name: httpd-frontend
    spec:
      containers:
      - name: httpd-frontend
        image: httpd:2.4-alpine

 

- Create a deployment named webapp using the image kodekloud/webapp-color with 3 replicas.

kubectl create deployment webapp --image=kodekloud/webapp-color --replicas=3

 

- Create a new deployment called redis-deploy in the dev-ns namespace with the redis image. It should have 2 replicas.

kubectl create deployment redis-deploy --image=redis --replicas=2 -n dev-ns

 

4. 출처

- https://learn.kodekloud.com/user/courses/udemy-labs-certified-kubernetes-administrator-with-practice-tests

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

[CKA] PV(PersistentVolume) 란?  (0) 2025.11.22
[CKA] StorageClass 란?  (0) 2025.11.21
[CKA] PriorityClass 란?  (0) 2025.11.21
[CKA] ReplicaSet 이란?  (0) 2025.11.21
[CKA] Pod 란?  (0) 2025.11.20