容器服务中CPFS 升级包含两部分:
Flexvolume-cpfs 插件升级;CPFS-Client 驱动升级;
PS:flexvolume-cpfs插件只支持cpfs-client驱动安装,不支持驱动升级。所以需要先升级flexvolume-cpfs插件,再手动升级cpfs-client底层驱动;
下面提供两种方法完成CPFS升级:
- 采用ECS的自动运维服务(OOS方式),在多个worker节点同时执行cpfs-client升级脚本;(此方法需要先将目标节点排水,然后在节点上执行升级脚本等操作;)
- 先将flexvolume-cpfs升级到目标版本,通过弹性运维(弹出新节点,业务迁移到新节点,旧节点缩掉);
推荐您使用方法2来实现升级过程;步骤如下:
步骤1:升级Flexvolume-cpfs;
将flexvolume的镜像升级到目标版本(v1.14.8.96-0d85fd1-aliyun)版本。
配置flexvolume的container增加env变量,定义cpfs-client驱动版本:
- name: CPFS_VERSION
value: 2.10.8-202
- name: DKMS_VERSION
value: 1.0.0-208
- name: CPFS_URL_PREFIX
value: https://cpfs-client.oss-cn-beijing.aliyuncs.com/centos
CPFS_VERSION是cpfs-client的version;DKMS_VERSION是cpfs-dkms-client的version;
CPFS_URL_PREFIX是下载指定cpfs版本的url前缀路径;
flexvolume-cpfs的yaml模板,执行升级命令:
$ kubectl apply -f flexvolume-cpfs.yaml
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: flexvolume-cpfs
namespace: kube-system
labels:
k8s-volume: flexvolume-cpfs
spec:
selector:
matchLabels:
name: flexvolume-cpfs
template:
metadata:
labels:
name: flexvolume-cpfs
spec:
hostPID: true
hostNetwork: true
tolerations:
- operator: "Exists"
priorityClassName: system-node-critical
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: type
operator: NotIn
values:
- virtual-kubelet
containers:
- name: flexvolume-cpfs
image: registry.cn-hangzhou.aliyuncs.com/acs/flexvolume:v1.14.8.96-0d85fd1-aliyun
imagePullPolicy: Always
securityContext:
privileged: true
env:
- name: ACS_CPFS
value: "true"
- name: FIX_ISSUES
value: "false"
- name: CPFS_VERSION
value: 2.10.8-202
- name: DKMS_VERSION
value: 1.0.0-208
- name: CPFS_URL_PREFIX
value: https://cpfs-client.oss-cn-beijing.aliyuncs.com/centos
livenessProbe:
exec:
command:
- sh
- -c
- ls /acs/flexvolume
failureThreshold: 8
initialDelaySeconds: 15
periodSeconds: 60
successThreshold: 1
timeoutSeconds: 15
volumeMounts:
- name: usrdir
mountPath: /host/usr/
- name: etcdir
mountPath: /host/etc/
- name: logdir
mountPath: /var/log/alicloud/
- mountPath: /var/lib/kubelet
mountPropagation: Bidirectional
name: kubeletdir
volumes:
- name: usrdir
hostPath:
path: /usr/
- name: etcdir
hostPath:
path: /etc/
- name: logdir
hostPath:
path: /var/log/alicloud/
- hostPath:
path: /var/lib/kubelet
type: Directory
name: kubeletdir
updateStrategy:
rollingUpdate:
maxUnavailable: 10%
type: RollingUpdate
步骤2:业务迁移
弹出新节点:flexvolume-cpfs升级完成后,新弹出的节点会自动安装新版本的cpfs-client;业务迁移:将老节点的pod排水到新弹出的节点上;
缩掉旧节点,完成业务迁移后,将老节点删除;