美文网首页
备战CKA每日一题——第13天

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

作者: 小E的私房菜 | 来源:发表于2020-03-13 15:35 被阅读0次

第十三题: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
扩容结果

相关文章

网友评论

      本文标题:备战CKA每日一题——第13天

      本文链接:https://www.haomeiwen.com/subject/xohlshtx.html