备战CKA每日一题——第13天

2020-03-13  本文已影响0人  小E的私房菜

第十三题:Scale:扩缩容:


题目:Scale the deployment webserver to 6 pods
解题思路:
解题步骤:
  1. 创建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
扩容结果
上一篇 下一篇

猜你喜欢

热点阅读