# 卸载 operator 。 operator 是独立的,operator 的状态不会影响现有的 Alluxio 集群
$ helm uninstall operator
release "operator" uninstalled
# 检查是否所有资源都已移除。命名空间是最后移除的资源
$ kubectl get ns alluxio-operator
Error from server (NotFound): namespaces "alluxio-operator" not found
# 在新的 helm chart 目录下运行以下命令,来首先升级 CRD
$ kubectl apply -f alluxio-operator/crds 2>/dev/null
customresourcedefinition.apiextensions.k8s.io/alluxioclusters.k8s-operator.alluxio.com configured
customresourcedefinition.apiextensions.k8s.io/underfilesystems.k8s-operator.alluxio.com configured
# 使用相同的 operator-config.yaml,仅更改镜像的标签,以重启 operator
$ helm install operator -f operator-config.yaml alluxio-operator
NAME: operator
LAST DEPLOYED: Thu Jun 27 15:47:44 2024
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None
# 将更改应用到 Kubernetes
$ kubectl apply -f alluxio-cluster.yaml
alluxiocluster.k8s-operator.alluxio.com/alluxio configured
# 验证是否升级。应能看到新的 pod 正在生成
$ kubectl get pod
NAME READY STATUS RESTARTS AGE
alluxio-etcd-0 1/1 Running 0 10m
alluxio-master-0 0/1 Init:0/2 0 7s
alluxio-monitor-grafana-b89bf9dbb-77pb6 1/1 Running 0 10m
alluxio-monitor-prometheus-59b7b8bd64-b95jh 1/1 Running 0 10m
alluxio-worker-58999f8ddd-cd6r2 0/1 Init:0/2 0 7s
alluxio-worker-5d6786f5bf-cxv5j 1/1 Running 0 10m
# 检查集群状态
$ kubectl get alluxiocluster
NAME CLUSTERPHASE AGE
alluxio Updating 10m
# 等待集群再次准备就绪
$ kubectl get alluxiocluster
NAME CLUSTERPHASE AGE
alluxio Ready 12m
# 检查集群的 pod。可看到 alluxio pod 的 age 已发生变化
$ kubectl get pod
NAME READY STATUS RESTARTS AGE
alluxio-etcd-0 1/1 Running 0 12m
alluxio-master-0 1/1 Running 0 93s
alluxio-monitor-grafana-b89bf9dbb-77pb6 1/1 Running 0 12m
alluxio-monitor-prometheus-59b7b8bd64-b95jh 1/1 Running 0 12m
alluxio-worker-58999f8ddd-cd6r2 1/1 Running 0 93s
alluxio-worker-58999f8ddd-rtftk 1/1 Running 0 33s
# 核对版本字符串
$ kubectl exec -it alluxio-master-0 -- alluxio info version 2>/dev/null
AI-3.2-5.2.0
# 将更改应用到 Kubernetes
$ kubectl apply -f alluxio-cluster.yaml
alluxiocluster.k8s-operator.alluxio.com/alluxio configured
# 验证集群是否正在升级。应能看到新的 pod 正在生成
$ kubectl get pod
NAME READY STATUS RESTARTS AGE
alluxio-etcd-0 1/1 Running 0 15m
alluxio-master-0 1/1 Running 0 4m51s
alluxio-monitor-grafana-b89bf9dbb-77pb6 1/1 Running 0 15m
alluxio-monitor-prometheus-59b7b8bd64-b95jh 1/1 Running 0 15m
alluxio-worker-58999f8ddd-cd6r2 1/1 Running 0 4m51s
alluxio-worker-58999f8ddd-rtftk 1/1 Running 0 3m51s
alluxio-worker-58999f8ddd-p6n59 0/1 PodInitializing 0 4s
# 检查新的实例是否已就绪
$ kubectl get pod
NAME READY STATUS RESTARTS AGE
alluxio-etcd-0 1/1 Running 0 16m
alluxio-master-0 1/1 Running 0 5m21s
alluxio-monitor-grafana-b89bf9dbb-77pb6 1/1 Running 0 16m
alluxio-monitor-prometheus-59b7b8bd64-b95jh 1/1 Running 0 16m
alluxio-worker-58999f8ddd-cd6r2 1/1 Running 0 5m21s
alluxio-worker-58999f8ddd-rtftk 1/1 Running 0 4m21s
alluxio-worker-58999f8ddd-p6n59 1/1 Running 0 34s