CC00138.CloudKubernetes——|KuberNetes&资源调度.V08|——|deployment.v06|更新注意事项|

一、Deployment注意事项
### --- 查看deployment.yaml配置文件

[root@k8s-master01 ~]# kubectl get deploy nginx -oyaml
apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    deployment.kubernetes.io/revision: "12"
    kubernetes.io/change-cause: kubectl set image deploy nginx nginx=nginx:1.15.3
      --record=true
  creationTimestamp: "2021-04-18T05:20:10Z"
  generation: 21
  labels:
    app: nginx
  managedFields:
  - apiVersion: apps/v1
    fieldsType: FieldsV1
    fieldsV1:
  name: nginx
  namespace: default
  resourceVersion: "920360"
  uid: 201bba44-1244-4f12-8920-59f3bba18e79
spec:
  progressDeadlineSeconds: 600
  replicas: 2
  revisionHistoryLimit: 10                                                          //它会给我们保留多个历史的副本。设置保留RS旧的revision的个数,设置为0的话,不保留历史数据。
  selector:
    matchLabels:
      app: nginx
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: nginx
    spec:
      containers:
      - image: nginx:1.15.3
        imagePullPolicy: IfNotPresent
        name: nginx
        resources:
          limits:
            cpu: 200m
            memory: 128Mi
          requests:
            cpu: 10m
            memory: 16Mi
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 30
status:
  availableReplicas: 2
  conditions:
  - lastTransitionTime: "2021-04-18T10:16:07Z"
    lastUpdateTime: "2021-04-18T10:16:07Z"
    message: Deployment has minimum availability.
    reason: MinimumReplicasAvailable
    status: "True"
    type: Available
  - lastTransitionTime: "2021-04-18T10:34:21Z"
    lastUpdateTime: "2021-04-18T10:34:53Z"
    message: ReplicaSet "nginx-68db656dd8" has successfully progressed.
    reason: NewReplicaSetAvailable
    status: "True"
    type: Progressing
  observedGeneration: 21
  readyReplicas: 2
  replicas: 2
  updatedReplicas: 2

二、deployment注意事项

### --- deployment注意事项

~~~     # .spec.revisionHistoryLimit:
~~~     设置保留RS旧的revision的个数,设置为0的话,不保留历史数据
~~~     # .spec.minReadySeconds:
~~~     可选参数,指定新创建的Pod在没有任何容器崩溃的情况下视为Ready最小的秒数,
~~~     默认为0,即一旦被创建就视为可用。
### --- 滚动更新的策略:

~~~     # .spec.strategy.type:
~~~     更新deployment的方式,默认是RollingUpdate
~~~     # RollingUpdate:
~~~     滚动更新,可以指定maxSurge和maxUnavailable
~~~     # maxUnavailable:
~~~     指定在回滚或更新时最大不可用的Pod的数量,可选字段,默认25%,
~~~     可以设置成数字或百分比,如果该值为0,那么maxSurge就不能0
~~~     # maxSurge:
~~~     可以超过期望值的最大Pod数,可选字段,默认为25%,
~~~     可以设置成数字或百分比,如果该值为0,那么maxUnavailable不能为0
~~~     # Recreate:
~~~     重建,先删除旧的Pod,在创建新的Pod
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

yanqi_vip

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值