第十三题:Scale:扩缩容:
题目:Scale the deployment webserver to 6 pods
解题思路:
- 纯考kubectl指令,具体参考:
https://kubernetes.io/docs/reference/kubectl/cheatsheet/
解题步骤:
- 创建deployments,副本数为3个:
sudo kubectl create -f deploymentTest.yaml -n ns-ehj
apiVersion: apps/v1
kind: Deployment
metadata:
creationTimestamp: null
labels:
name: deployment-test
name: deployment-test
namespace: ns-ehj
spec:
replicas: 3
selector:
matchLabels:
name: deployment-test
template:
metadata:
labels:
name: deployment-test
spec:
containers:
- image: nginx
name: deployment-nginx
执行结果:
初始化3个pod
2.执行scale指令做扩容:
sudo kubectl scale --replicas=6 deployment/deployment-test -n ns-ehj
扩容结果
网友评论