이 게시물은 아래 강의를 참고 하였습니다.
참고 강의 https://www.youtube.com/watch?v=KdATmTulf7s&list=PLApuRlvrZKojqx9-wIvWP3MPtgy2B372f&index=1
문제 1) Pod scale out
작업 클러스터 : k8s
- Expand the number of running Pods in "eshop-order" to 5
- namespace : devops
- deployment : eshop-order
답안)
$ kubectl config use-context k8s
https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#scale 에서 Scale 명령어 확인
$ sudo kubectl scale deployment eshop-order -n devops --replicas=5
문제 2) Deployment 생성하고 Scailing 하기
- Create a deployment as follows:
- Task:
- name : webserver
- 2 replicas
- label : app_env_stage=dev
- container name : webserver
- container image : nginx:1.14
- Scale Out Depolyment
- Scale the deployment webserver to 3 pods
답안)
1) deployment 생성
$ sudo kubectl create deployment webserver --image=nginx:1.14 --replicas=2 --dry-run=client -o yaml > webserver.yaml
$ sudo vi webserver.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: webserver
spec:
replicas: 2
selector:
matchLabels:
app_env_stage: dev
template:
metadata:
labels:
app_env_stage: dev
spec:
containers:
- image: nginx:1.14
name: webserver
$ sudo kubectl apply -f webserver.yaml
2) Scale out
$ sudo kubectl scale deployment webserver --replicas=3
'k8s' 카테고리의 다른 글
CKA 준비 (8) Node Selector (0) | 2022.05.30 |
---|---|
CKA 준비 (7) Rolling Update & Roll Back (0) | 2022.05.30 |
CKA 준비 (5) Side-car Container Pod 실행하기 (0) | 2022.05.24 |
CKA 준비 (4) multi-container Pod 생성하기 (0) | 2022.05.24 |
CKA 준비 (3) Static pod 생성하기 (0) | 2022.05.23 |