Udemy의 Certified Kubernetes Administrator (CKA) with Practice Tests 강의의 33. Certification Tip! 챕터를 공부한 내용으로 강의 내용과 다를 수 있습니다. 정확한 내용은 강의를 들으시는 것을 추천드립니다.
YAML file을 만드는 것보다 kubectl 커맨드를 사용하는 것이 훨신 편할 때가 있다.
이에 하단 링크를 참고해 kubectl 명령어에 익숙해지는 것을 권장한다.
https://kubernetes.io/docs/reference/kubectl/conventions/
- nginx pod 생성
kubectl run nginx --image=nginx
- '-o yaml' 옵션에 위치한 POD Manifest YAML file을 생성 한다.
'--dry-run' 옵션 뒤의 설정에 따라 kubernetes API 서버에 명령을 전달 하지 않아 pod를 만들지 않는다.
kubectl run nginx --image=nginx --dry-run=client -o yaml
- nginx deployment 생성
kubectl create deployment --image=nginx nginx
- '-o yaml' 옵션에 위치한 deployment Manifest YAML file을 생성 한다.
'--dry-run' 옵션 뒤의 설정에 따라 kubernetes API 서버에 명령을 전달 하지 않아 pod를 만들지 않는다.
kubectl create deployment --image=nginx nginx --dry-run=client -o yaml
- '-o yaml' 옵션에 위치한 deployment Manifest YAML file을 생성해 nginx-deployment.yaml에 저장한다.
'--dry-run' 옵션 뒤의 설정에 따라 kubernetes API 서버에 명령을 전달 하지 않아 pod를 만들지 않는다.
kubectl create deployment --image=nginx nginx --dry-run=client -o yaml > nginx-deployment.yaml
- 저장 된 파일은 복제본 수 변경 등 필요에 따라 deployment를 만드는데 사용한다.
kubectl create -f nginx-deployment.yaml
- kubernetes 1.19+ 버전 에서는 '--replicas' 옵션을 지정해 4개의 복제본이 있는 Deployment를 생성 할 수 있다.
kubectl create deployment --image=nginx nginx --replicas=4 --dry-run=client -o yaml > nginx-deployment.yaml
'IT 강의 > 도커 쿠버' 카테고리의 다른 글
[CKA 강의 요약] Services (0) | 2024.06.19 |
---|---|
[CKA 강의 요약] Practice Test - Deployments, Solution - Deployments (Optional) (0) | 2024.06.19 |
[CKA 강의 요약] Deployments (0) | 2024.06.13 |
[CKA 강의 요약] Practice Test - ReplicaSets, ReplicaSets - Solution (Optional) (0) | 2024.06.11 |
[CKA 강의 요약] Recap - ReplicaSets (0) | 2024.04.01 |