- Deployment를 scale out
kubectl scale deployment <deplyment-name> -n devops --replicas=5
kubectl get pods -n devops
- deployment 생성하고 scale out
label: app_env_stage=dev
kubectl create deployment <deployment-name> --image=<image-name> --replicas=2 --dry-run=client -o yaml > deployment.yaml
vi deployment.yaml
spec 섹션의 matchlabels는 template의 metadata labels와 일치.
...
spec:
replicas: 2
selector:
matchLabels:
app_env_stage: dev
template:
metadata:
labels:
app_env_stage: dev
spec:
containers:
- image: nginx:1.14
name: webserver
ports:
- containerPort: 80
kubectl apply -f deployment.yaml
kubectl get deployment.apps -o wide
kubectl scale deployment <deployment-name> --replicas=3
kubectl get pods --show-labels
출처