新版 VolumeSnapshot 使用注意事项-云惠网

云惠网小编 2021年1月23日16:56:16
评论
6993字阅读23分18秒
摘要

基础文档: https://developer.aliyun.com/article/757325

广告也精彩

阿里云2000元通用代金券点击领取

基础文档: https://developer.aliyun.com/article/757325

背景: csi-plugin 插件于近期进行一次重大升级,升级到最新版本的 csi-plugin 镜像在使用 VolumeSnapshot 的时候需要做模板上的变更。 使用 csi-plugin:v1.14.8.42-9451f619-aliyun 以及以上版本的镜像需要参照如下内容对模板进行升级

升级方式: 删除原有 csi-snapshotter deployment 按照如下模板部署新的 deployment

csi-snapshotter yaml

kind: Deployment
apiVersion: apps/v1
metadata:
  name: csi-snapshotter
  namespace: kube-system
spec:
  selector:
    matchLabels:
      app: csi-snapshotter
  replicas: 1
  template:
    metadata:
      labels:
        app: csi-snapshotter
    spec:
      tolerations:
      - operator: "Exists"
      affinity:
        nodeAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
          - weight: 1
            preference:
              matchExpressions:
              - key: node-role.kubernetes.io/master
                operator: Exists
      priorityClassName: system-node-critical
      serviceAccount: admin
      hostNetwork: true
      containers:
        - name: snapshot-controller
          image: registry.cn-hangzhou.aliyuncs.com/plugins/snapshot-controller:v2.0.1
          args:
            - "--v=5"
            - "--leader-election=false"
          imagePullPolicy: Always
        - name: disk-snapshotter
          image: registry.cn-hangzhou.aliyuncs.com/plugins/csi-snapshotter:v2.1.1
          args:
            - "--csi-address=$(ADDRESS)"
          env:
            - name: ADDRESS
              value: /var/lib/kubelet/csi-plugins/diskplugin.csi.alibabacloud.com/csi.sock
          imagePullPolicy: "Always"
          volumeMounts:
            - name: disk-provisioner-dir
              mountPath: /var/lib/kubelet/csi-plugins/diskplugin.csi.alibabacloud.com/
        - name: csi-diskprovisioner
          securityContext:
            privileged: true
            capabilities:
              add: ["SYS_ADMIN"]
            allowPrivilegeEscalation: true
          image: registry.cn-hangzhou.aliyuncs.com/acs/csi-plugin:v1.14.8.42-9451f619-aliyun
          imagePullPolicy: "Always"
          args:
            - "--endpoint=$(CSI_ENDPOINT)"
            - "--v=2"
            - "--driver=disk"
          env:
            - name: CSI_ENDPOINT
              value: unix://var/lib/kubelet/csi-plugins/driverplugin.csi.alibabacloud.com-replace/csi.sock
            - name: SERVICE_PORT
              value: "11271"
            - name: SERVICE_TYPE
              value: "provisioner"
          volumeMounts:
            - name: host-log
              mountPath: /var/log/
            - name: disk-provisioner-dir
              mountPath: /var/lib/kubelet/csi-plugins/diskplugin.csi.alibabacloud.com/
            - name: etc
              mountPath: /host/etc
      volumes:
        - name: disk-provisioner-dir
          emptyDir: {}
        - name: host-log
          hostPath:
            path: /var/log/
        - name: etc
          hostPath:
            path: /etc

注意点

  1. yaml 中 driverplugin.csi.alibabacloud.com-replace 会被替换, 不用理会
  2. yaml 中 --driver=disk 同样会被替换, VolumeSnapshotClass driver 保留原先 diskplugin.csi.alibabacloud.com 即可

升级方式: 删除原有 csi-provisioner deployment 按照如下模板部署新的 deployment

csi-provisioner.yaml

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  labels:
    app: csi-provisioner
  name: csi-provisioner
  namespace: kube-system
spec:
  progressDeadlineSeconds: 600
  replicas: 2
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app: csi-provisioner
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: csi-provisioner
    spec:
      affinity:
        nodeAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
          - preference:
              matchExpressions:
              - key: node-role.kubernetes.io/master
                operator: Exists
            weight: 1
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
            - matchExpressions:
              - key: type
                operator: NotIn
                values:
                - virtual-kubelet
      containers:
      - args:
        - --provisioner=diskplugin.csi.alibabacloud.com
        - --csi-address=$(ADDRESS)
        - --feature-gates=Topology=True
        - --volume-name-prefix=disk
        - --strict-topology=true
        - --timeout=150s
        - --enable-leader-election=true
        - --leader-election-type=leases
        - --retry-interval-start=500ms
        - --v=5
        env:
        - name: ADDRESS
          value: /var/lib/kubelet/csi-provisioner/diskplugin.csi.alibabacloud.com/csi.sock
        image: registry.cn-hangzhou.aliyuncs.com/acs/csi-provisioner:v1.6.0-fc9e11563-ack
        imagePullPolicy: Always
        name: external-disk-provisioner
        resources: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /var/lib/kubelet/csi-provisioner/diskplugin.csi.alibabacloud.com
          name: disk-provisioner-dir
      - args:
        - --v=5
        - --csi-address=$(ADDRESS)
        - --leader-election=true
        env:
        - name: ADDRESS
          value: /var/lib/kubelet/csi-provisioner/diskplugin.csi.alibabacloud.com/csi.sock
        image: registry-vpc.cn-beijing.aliyuncs.com/acs/csi-attacher:v2.1.0
        imagePullPolicy: Always
        name: external-disk-attacher
        resources: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /var/lib/kubelet/csi-provisioner/diskplugin.csi.alibabacloud.com
          name: disk-provisioner-dir
      - args:
        - --v=5
        - --csi-address=$(ADDRESS)
        - --leader-election
        env:
        - name: ADDRESS
          value: /var/lib/kubelet/csi-provisioner/diskplugin.csi.alibabacloud.com/csi.sock
        image: registry-vpc.cn-beijing.aliyuncs.com/acs/csi-resizer:v0.3.0
        imagePullPolicy: Always
        name: external-disk-resizer
        resources: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /var/lib/kubelet/csi-provisioner/diskplugin.csi.alibabacloud.com
          name: disk-provisioner-dir
      - args:
        - --provisioner=nasplugin.csi.alibabacloud.com
        - --csi-address=$(ADDRESS)
        - --volume-name-prefix=nas
        - --timeout=150s
        - --enable-leader-election=true
        - --leader-election-type=leases
        - --retry-interval-start=500ms
        - --v=5
        env:
        - name: ADDRESS
          value: /var/lib/kubelet/csi-provisioner/nasplugin.csi.alibabacloud.com/csi.sock
        image: registry-vpc.cn-beijing.aliyuncs.com/acs/csi-provisioner:v1.4.0-aliyun
        imagePullPolicy: Always
        name: external-nas-provisioner
        resources: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /var/lib/kubelet/csi-provisioner/nasplugin.csi.alibabacloud.com
          name: nas-provisioner-dir
      - args:
        - --endpoint=$(CSI_ENDPOINT)
        - --v=2
        - --driver=nas,disk
        env:
        - name: CSI_ENDPOINT
          value: unix://var/lib/kubelet/csi-provisioner/driverplugin.csi.alibabacloud.com-replace/csi.sock
        - name: MAX_VOLUMES_PERNODE
          value: "15"
        - name: SERVICE_TYPE
          value: provisioner
        image: registry.cn-hangzhou.aliyuncs.com/acs/csi-plugin:v1.14.8.42-9451f619-aliyun
        imagePullPolicy: Always
        livenessProbe:
          failureThreshold: 5
          httpGet:
            path: /healthz
            port: healthz
            scheme: HTTP
          initialDelaySeconds: 10
          periodSeconds: 30
          successThreshold: 1
          timeoutSeconds: 3
        name: csi-provisioner
        ports:
        - containerPort: 11270
          hostPort: 11270
          name: healthz
          protocol: TCP
        resources:
          limits:
            cpu: 100m
            memory: 100Mi
          requests:
            cpu: 100m
            memory: 100Mi
        securityContext:
          allowPrivilegeEscalation: true
          capabilities:
            add:
            - SYS_ADMIN
          privileged: true
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /dev
          mountPropagation: HostToContainer
          name: host-dev
        - mountPath: /var/log/
          name: host-log
        - mountPath: /host/etc
          name: etc
        - mountPath: /var/lib/kubelet/csi-provisioner/diskplugin.csi.alibabacloud.com
          name: disk-provisioner-dir
        - mountPath: /var/lib/kubelet/csi-provisioner/nasplugin.csi.alibabacloud.com
          name: nas-provisioner-dir
      dnsPolicy: ClusterFirst
      hostNetwork: true
      priorityClassName: system-node-critical
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      serviceAccount: admin
      serviceAccountName: admin
      terminationGracePeriodSeconds: 30
      volumes:
      - emptyDir: {}
        name: disk-provisioner-dir
      - emptyDir: {}
        name: nas-provisioner-dir
      - hostPath:
          path: /var/log/
          type: ""
        name: host-log
      - hostPath:
          path: /dev
          type: ""
        name: host-dev
      - hostPath:
          path: /etc
          type: ""
        name: etc

注意点

  1. external-disk-provisioner 的版本需要保持在1.6 之上, 否则不会识别 pvc 中的 datasource 字段 导致 restore 失败

权限

  1. 保证 ACK worker role 拥有 ecs 快照相关操作权限。 下面列出所需权限列表
  • CreateSnapshot
  • DescribeSnapshotAttribute
  • DescribeSnapshots
  • DescribeSnapshotLinks
  • CreateAutoSnapshotPolicy(option)
  • ApplyAutoSnapshotPolicy(option)
  • CancelAutoSnapshotPolicy(option)
  • DeleteAutoSnapshotPolicy(option)
腾讯云618
未分类
云惠网小编
SpringCloud -- Config、Bus解析

SpringCloud — Config、Bus解析

1、Config1.1、概述简介1. 分布式面临的问题微服务意味着要将单体应用中的业务拆分成一个个子服务,每个服务的粒度相对较小,因此系统中会出现大量的服务。由于每个服务都需要必要...
Java数据结构-了解复杂度

Java数据结构-了解复杂度

2.实例分析与计算  四.写在最后  // 计算斐波那契递归fibonacci的时间复杂度 int fibonacci(int N) { return N < 2 ? N : fibonacci...
[深度解剖C语言] --关键字 static

[深度解剖C语言] –关键字 static

static ---最名不副实的关键字目录1.static修饰全局变量2.static修饰函数3.static修饰局部变量static的作用:1.static修饰全局变量我们创建两...
Java数据结构-认识顺序表

Java数据结构-认识顺序表

目录二.顺序表1.概念及结构2.顺序表的实现打印顺序表获取顺序表的有效长度在pos位置新增元素判断是否包含某个元素查找某个元素对应的位置获取/查找pos位置的元素给pos位置的元素...
腾讯云618

发表评论