新版 VolumeSnapshot 使用注意事项

本文涉及的产品
文件存储 NAS,50GB 3个月
简介: 基础文档: https://developer.aliyun.com/article/757325 背景: csi-plugin 插件于近期进行一次重大升级,升级到最新版本的 csi-plugin 镜像在使用 VolumeSnapshot 的时候需要做模板上的变更。 使用 csi-plugin:v1.14.8.42-9451f619-aliyun 以及以上版本的镜像需要参照如下内容对模板进行

基础文档: 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)
相关实践学习
基于ECS和NAS搭建个人网盘
本场景主要介绍如何基于ECS和NAS快速搭建个人网盘。
阿里云文件存储 NAS 使用教程
阿里云文件存储(Network Attached Storage,简称NAS)是面向阿里云ECS实例、HPC和Docker的文件存储服务,提供标准的文件访问协议,用户无需对现有应用做任何修改,即可使用具备无限容量及性能扩展、单一命名空间、多共享、高可靠和高可用等特性的分布式文件系统。 产品详情:https://www.aliyun.com/product/nas
目录
相关文章
|
存储 Kubernetes 测试技术
Kubernetes snapshots 快照是什么以及如何使用快照
Kubernetes snapshots 快照是什么以及如何使用快照
625 0
|
7月前
发布注意事项
发布注意事项
41 0
|
域名解析 Kubernetes 网络协议
k8s教程(service篇)-pod的dns域名
k8s教程(service篇)-pod的dns域名
2185 0
|
监控 Kubernetes Cloud Native
浅谈基于 OpenStack 和 k8s 建设云原生研发基础设施
建设公司云原生研发基础设施,为研发部门提供安全、可靠、高效的基础资源、数据存储服务、DevOps 流水线以及运维自动化服务等。
4271 4
浅谈基于 OpenStack 和 k8s 建设云原生研发基础设施
|
Java 数据安全/隐私保护
[Recaf 3.x ] #1 新版工具功能介绍
recaf 3.0的ssvm功能的使用
414 0
|
Kubernetes 容器 Perl
【kubernetes】解决: kubelet Failed to create pod sandbox: rpc error: code = Unknown desc = faile...
【kubernetes】解决: kubelet Failed to create pod sandbox: rpc error: code = Unknown desc = faile...
11693 0
|
Cloud Native 分布式数据库
用户指南—实例管理—版本升级
您可以升级PolarDB-X实例到最新版本,快速体验实例新特性,本文将介绍如何在控制台上升级实例版本。
104 0
用户指南—实例管理—版本升级
|
Cloud Native 分布式数据库 数据库
【笔记】用户指南—如何查看和升级实例版本
本文介绍PolarDB-X 2.0实例版本的相关信息。
118 0
|
存储 Kubernetes 网络协议
Kubernetes 集群部署 NFS-Subdir-External-Provisioner 存储插件
Kubernetes 对 Pod 进行调度时,以当时集群中各节点的可用资源作为主要依据,自动选择某一个可用的节点,并将 Pod 分配到该节点上。在这种情况下,Pod 中容器数据的持久化如果存储在所在节点的磁盘上,就会产生不可预知的问题,例如,当 Pod 出现故障,Kubernetes 重新调度之后,Pod 所在的新节点上,并不存在上一次 Pod 运行时所在节点上的数
6568 2
Kubernetes 集群部署 NFS-Subdir-External-Provisioner 存储插件
|
Cloud Native 分布式数据库 数据库
用户指南—如何查看和升级实例版本
本文介绍PolarDB-X 2.0实例版本的相关信息。
126 0

热门文章

最新文章