首页 > 其他分享 >helm upgrade rancher server from v2.7.5 to v2.7.8 in kubernetes【helm 升级 rancher 】

helm upgrade rancher server from v2.7.5 to v2.7.8 in kubernetes【helm 升级 rancher 】

时间:2023-12-21 12:32:01浏览次数:42  
标签:rke2 v2.7 system helm Running cattle rancher kube


helm upgrade rancher server from v2.7.5 to v2.7.8 in kubernetes【helm 升级 rancher 】_2d


文章目录

  • 1. 预备条件
  • 2. 目标
  • 3. 下载介质
  • 4. 镜像入库
  • 5. 升级 rancher
  • 6. 检查测试


1. 预备条件

  • Kubernetes Cluster
  • Helm & Kubernetes Offline Deploy Rancher v2.7.5 Demo

注意:如果你是在vcenter 的虚拟机测试该应用,记得给当前版本做好快照,便于反复练习。

2. 目标

  • rancher v2.7.5 升级 v2.7.8

当前集群 状态

$ helm ls -n cattle-system
NAME            NAMESPACE       REVISION        UPDATED                                 STATUS          CHART                           APP VERSION
rancher         cattle-system   1               2023-12-12 15:15:55.470319744 +0800 CST deployed        rancher-2.7.5                   v2.7.5     
rancher-webhook cattle-system   1               2023-12-12 07:23:47.884505024 +0000 UTC deployed        rancher-webhook-2.0.5+up0.3.5   0.3.5  

$ kubectl get pod -A
NAMESPACE                   NAME                                                    READY   STATUS      RESTARTS        AGE
cattle-fleet-local-system   fleet-agent-fbcbb8456-sfk5z                             1/1     Running     0               2d16h
cattle-fleet-system         fleet-controller-748ff89bfc-n8lct                       1/1     Running     2 (2d16h ago)   2d19h
cattle-fleet-system         gitjob-7bd88ddd7d-dwl4z                                 1/1     Running     1 (2d16h ago)   2d19h
cattle-system               rancher-bc4795d88-6dwmh                                 1/1     Running     1 (2d16h ago)   2d19h
cattle-system               rancher-bc4795d88-9wcn7                                 1/1     Running     1 (2d16h ago)   2d19h
cattle-system               rancher-bc4795d88-9xbsh                                 1/1     Running     2 (2d16h ago)   2d19h
cattle-system               rancher-webhook-7f6b5f4dd6-2jv2f                        1/1     Running     1 (2d16h ago)   2d19h
demo                        nginx                                                   1/1     Running     1 (2d16h ago)   2d16h
kube-system                 cloud-controller-manager-rancher02                      1/1     Running     7 (2d16h ago)   2d23h
kube-system                 etcd-rancher02                                          1/1     Running     2               2d23h
kube-system                 helm-install-rke2-canal-wrsjx                           0/1     Completed   0               2d23h
kube-system                 helm-install-rke2-coredns-nh95s                         0/1     Completed   0               2d23h
kube-system                 helm-install-rke2-ingress-nginx-h4p5q                   0/1     Completed   0               2d23h
kube-system                 helm-install-rke2-metrics-server-jg5fk                  0/1     Completed   0               2d23h
kube-system                 helm-install-rke2-snapshot-controller-crd-49t77         0/1     Completed   0               2d23h
kube-system                 helm-install-rke2-snapshot-controller-tkmjc             0/1     Completed   0               2d23h
kube-system                 helm-install-rke2-snapshot-validation-webhook-fnlc2     0/1     Completed   0               2d23h
kube-system                 kube-apiserver-rancher02                                1/1     Running     6               2d23h
kube-system                 kube-controller-manager-rancher02                       1/1     Running     7 (2d16h ago)   2d23h
kube-system                 kube-proxy-rancher02                                    1/1     Running     3 (2d16h ago)   2d16h
kube-system                 kube-scheduler-rancher02                                1/1     Running     2 (2d16h ago)   2d23h
kube-system                 rke2-canal-bqx25                                        2/2     Running     4 (2d16h ago)   2d23h
kube-system                 rke2-coredns-rke2-coredns-565dfc7d75-6g9wm              1/1     Running     2 (2d16h ago)   2d23h
kube-system                 rke2-coredns-rke2-coredns-autoscaler-6c48c95bf9-28tz8   1/1     Running     2 (2d16h ago)   2d23h
kube-system                 rke2-ingress-nginx-controller-4xhm8                     1/1     Running     2 (2d16h ago)   2d23h
kube-system                 rke2-metrics-server-c9c78bd66-rjwn7                     1/1     Running     2 (2d16h ago)   2d23h
kube-system                 rke2-snapshot-controller-6f7bbb497d-wft92               1/1     Running     2 (2d16h ago)   2d23h
kube-system                 rke2-snapshot-validation-webhook-65b5675d5c-2dckg       1/1     Running     2 (2d16h ago)   2d23h

3. 下载介质

helm repo add rancher-latest https://releases.rancher.com/server-charts/latest
helm repo update
helm fetch rancher-latest/rancher --version=v2.7.8

4. 镜像入库

$ ls
images_list.txt  images.sh

$  cat images_list.txt 
docker.io/rancher/rancher:v2.7.8
docker.io/rancher/fleet-agent:v0.8.0
docker.io/rancher/fleet:v0.8.0
docker.io/rancher/gitjob:v0.1.76
docker.io/rancher/rancher-webhook:v0.3.6
docker.io/rancher/shell:v0.1.21
docker.io/rancher/mirrored-cluster-api-controller:v1.4.4
docker.io/rancher/kubectl:v1.20.2

$ cat images.sh
#!/bin/bash

#私有仓库
registry_name='harbor.fumai02.com'
BASE_DIR="$( dirname "$( readlink -f "${0}" )" )"
#项目名
project='rancher'

images_pull() {
 while read -r line 
 do
    sudo docker pull  $line
 done < images_list.txt

}

images_push() {
while read -r line
do
    image_repo=`echo $line | awk -F '/' '{print $1}'`
    image_name=`echo $line | awk -F '/' '{print $NF}' | awk -F ':' '{print $1}'`
    image_tag=`echo $line | awk -F '/' '{print $NF}' | awk -F ':' '{print $2}'`
    sudo docker tag $line ${registry_name}/${project}/${image_name}:${image_tag}
    sudo docker push ${registry_name}/${project}/${image_name}:${image_tag}

done < images_list.txt
}


images_pull
images_push

拉取公网镜像推送到私有仓库

$ sh images.sh

5. 升级 rancher

使用以下命令创建 rancher:

helm upgrade rancher ./rancher-2.7.8.tgz \
    --namespace cattle-system \
    --set hostname=rancher02.ghostwritten.com \
    --set rancherImage=harbor.fumai02.com/rancher/rancher \
    --set ingress.tls.source=secret \
    --set privateCA=true \
    --set systemDefaultRegistry=harbor.fumai02.com \
    --set useBundledSystemChart=true

输出:

Release "rancher" has been upgraded. Happy Helming!
NAME: rancher
LAST DEPLOYED: Fri Dec 15 15:27:55 2023
NAMESPACE: cattle-system
STATUS: deployed
REVISION: 3
TEST SUITE: None
NOTES:
Rancher Server has been installed.

NOTE: Rancher may take several minutes to fully initialize. Please standby while Certificates are being issued, Containers are started and the Ingress rule comes up.

Check out our docs at https://rancher.com/docs/

If you provided your own bootstrap password during installation, browse to https://rancher02.ghostwritten.com to get started.

If this is the first time you installed Rancher, get started by running this command and clicking the URL it generates:


echo https://rancher02.ghostwritten.com/dashboard/?setup=$(kubectl get secret --namespace cattle-system bootstrap-secret -o go-template='{{.data.bootstrapPassword|base64decode}}')


To get just the bootstrap password on its own, run:


kubectl get secret --namespace cattle-system bootstrap-secret -o go-template='{{.data.bootstrapPassword|base64decode}}{{ "\n" }}'



Happy Containering!

6. 检查测试

升级后效果

$ helm ls -n cattle-system
NAME            NAMESPACE       REVISION        UPDATED                                 STATUS          CHART                           APP VERSION
rancher         cattle-system   1               2023-10-26 07:31:49.883540457 +0800 CST deployed        rancher-2.7.8                   v2.7.8     
rancher-webhook cattle-system   1               2023-10-25 23:46:00.925115778 +0000 UTC deployed        rancher-webhook-2.0.6+up0.3.6   0.3.6      
$ kubectl get pod  -A
NAMESPACE                         NAME                                                    READY   STATUS      RESTARTS        AGE
cattle-fleet-local-system         fleet-agent-74466cd6dc-xc6jp                            1/1     Running     0               38m
cattle-fleet-system               fleet-controller-5989b98fc8-h6m57                       1/1     Running     0               40m
cattle-fleet-system               gitjob-d8f7cc69b-jvjh6                                  1/1     Running     0               40m
cattle-provisioning-capi-system   capi-controller-manager-6c4d64c64-wbgf7                 1/1     Running     0               38m
cattle-system                     helm-operation-bzzr7                                    0/2     Completed   0               41m
cattle-system                     helm-operation-pm6w8                                    0/2     Completed   0               30m
cattle-system                     helm-operation-qgs7j                                    0/2     Completed   0               39m
cattle-system                     helm-operation-sfxlc                                    0/2     Completed   0               42m
cattle-system                     rancher-7f87fb778f-ggh5q                                1/1     Running     0               51m
cattle-system                     rancher-7f87fb778f-hmlxq                                1/1     Running     0               46m
cattle-system                     rancher-7f87fb778f-vvzl6                                1/1     Running     0               51m
cattle-system                     rancher-webhook-7f4c7c4c4b-f4ddl                        1/1     Running     0               39m
demo                              nginx                                                   1/1     Running     1 (2d22h ago)   2d22h
kube-system                       cloud-controller-manager-rancher02                      1/1     Running     7 (2d22h ago)   3d5h
kube-system                       etcd-rancher02                                          1/1     Running     2               3d4h
kube-system                       helm-install-rke2-canal-wrsjx                           0/1     Completed   0               3d5h
kube-system                       helm-install-rke2-coredns-nh95s                         0/1     Completed   0               3d5h
kube-system                       helm-install-rke2-ingress-nginx-h4p5q                   0/1     Completed   0               3d5h
kube-system                       helm-install-rke2-metrics-server-jg5fk                  0/1     Completed   0               3d5h
kube-system                       helm-install-rke2-snapshot-controller-crd-49t77         0/1     Completed   0               3d5h
kube-system                       helm-install-rke2-snapshot-controller-tkmjc             0/1     Completed   0               3d5h
kube-system                       helm-install-rke2-snapshot-validation-webhook-fnlc2     0/1     Completed   0               3d5h
kube-system                       kube-apiserver-rancher02                                1/1     Running     6               3d4h
kube-system                       kube-controller-manager-rancher02                       1/1     Running     7 (2d22h ago)   3d5h
kube-system                       kube-proxy-rancher02                                    1/1     Running     3 (2d22h ago)   2d22h
kube-system                       kube-scheduler-rancher02                                1/1     Running     2 (2d22h ago)   3d5h
kube-system                       rke2-canal-bqx25                                        2/2     Running     4 (2d22h ago)   3d4h
kube-system                       rke2-coredns-rke2-coredns-565dfc7d75-6g9wm              1/1     Running     2 (2d22h ago)   3d4h
kube-system                       rke2-coredns-rke2-coredns-autoscaler-6c48c95bf9-28tz8   1/1     Running     2 (2d22h ago)   3d4h
kube-system                       rke2-ingress-nginx-controller-4xhm8                     1/1     Running     2 (2d22h ago)   3d4h
kube-system                       rke2-metrics-server-c9c78bd66-rjwn7                     1/1     Running     2 (2d22h ago)   3d4h
kube-system                       rke2-snapshot-controller-6f7bbb497d-wft92               1/1     Running     2 (2d22h ago)   3d4h
kube-system                       rke2-snapshot-validation-webhook-65b5675d5c-2dckg       1/1     Running     2 (2d22h ago)   3d4h

查看 rancher 镜像版本

$ kubectl get pod -n cattle-system -oyaml rancher-7f87fb778f-ggh5q  |grep image
    image: harbor.fumai02.com/rancher/rancher:v2.7.8

界面访问

helm upgrade rancher server from v2.7.5 to v2.7.8 in kubernetes【helm 升级 rancher 】_2d_02


查看升级前创建的 user 是否丢失

helm upgrade rancher server from v2.7.5 to v2.7.8 in kubernetes【helm 升级 rancher 】_云原生_03

通过user demo 登陆界面创建的 pod 实例仍正常可以获取状态

helm upgrade rancher server from v2.7.5 to v2.7.8 in kubernetes【helm 升级 rancher 】_2d_04


标签:rke2,v2.7,system,helm,Running,cattle,rancher,kube
From: https://blog.51cto.com/ghostwritten/8921576

相关文章

  • Helm部署Harbor,实现高可用的镜像仓库(超详细分享)
    Helm部署Harbor,实现高可用的镜像仓库(超详细分享) 前言:从业务场景看Harbor部署我在前面的文章中介绍了离线安装、在线安装等Harbor的部署方式,但其缺点都是无法做高可用,在实际的业务场景中一旦Harbor服务器异常,将会造成很大的影响。对应前面的几种部署方式,官方也并没有给出高可......
  • docker方式安装Rancher 2.6.9
    一、说明公司当前有一个用TKE搭建的K8s集群,目前遇到的问题:目前TKE已经基本不更新了公司内K8s集群所承载了所有项目的测试环境,目前资源已经无法满足一台节点坏跟现网集群环境不一致,现网是每个项目一个集群针对上面的问题,经过内部沟通,决定在公司内重新搭建一套多集群K8s环境,为了便于......
  • 如何使用 Helm 在 K8s 上集成 Prometheus 和 Grafana|Part 1
    本系列将分成三个部分,您将学习如何使用Helm在Kubernetes上集成Prometheus和Grafana,以及如何在Grafana上创建一个简单的控制面板。Prometheus和Grafana是Kubernetes最受欢迎的两种开源监控工具。学习如何使用Helm集成这两个工具,使您能够轻松监控Kubernetes集群并......
  • rancher harvester deploy demo 【部署 harvester v1.2.1】
    简介Harvester是一个现代的、开放的、可互操作的、基于Kubernetes的超融合基础设施(HCI)解决方案。它是一种开源替代方案,专为寻求云原生HCI解决方案的运营商而设计。Harvester运行在裸机服务器上,提供集成的虚拟化和分布式存储功能。除了传统的虚拟机(vm)之外,Harvester还通过与Ranc......
  • helm v3 部署 ingress-nginx
    1、部署helmv3略...()2、添加源并更新[root@master1ingress]#helmrepoaddingress-nginxhttps://kubernetes.github.io/ingress-nginx[root@master1ingress]#helmrepoupdate3、拉取镜像[root@master1ingress]#helmpullingress-nginx/ingress-nginx4、解压并修改......
  • 部署 helm3 包管理器
    1、下载helm3的安装包wgethttps://get.helm.sh/helm-v3.0.0-linux-amd64.tar.gz2、解压并赋予权限[root@node2~]#tar-zxfhelm-v3.7.1-linux-amd64.tar.gz[root@node2~]#chmod+xlinux-amd64/helm3、复制linux-amd64文件夹下的helm脚本到/usr/bin/路径下[root@node......
  • 部署 helm2 包管理器
    介绍Helm是一个kubernetes应用的包管理工具,用来管理预先配置好的安装包资源。Helmchart是用来封装kubernetes原生应用程序的yaml文件,可以在你部署应用的时候自定义应用程序的一些metadata,便与应用程序的分发。架构解释Helm:是一个命令行下的客户端工具。主要用于Kubernetes应......
  • helm部署Kafka集群
    1.准备文件1.1.创建命令空间kubectlcreatenskafka1.1.helm包拉取本地#添加bitnami仓库helmrepoaddbitnamihttps://charts.bitnami.com/bitnami#查询charthelmsearchrepobitnami#拉取zookeeperhelmpullbitnami/zookeeper#解压tarzxvfzookeeper-12.0.......
  • Helm Chart 部署 Redis 的完美指南
    目录一、Helm介绍二、安装Helm三、配置Helm的repository四、部署chart(以部署redis为例)1.搜索chart2.拉取chart3.修改values.yaml的一些配置(简单演示一下基本的配置)4.启动chart5.升级和回滚a.升级b.回滚一、Helm介绍Helm是一个Kubernetes的包管理工具,就像Linux下的包管......
  • helm
    一.Helm基本概念1.1为何需要Helm1.2什么是Helm1.3Helm核心概念1.4Helm安装二.Helm仓库管理2.1查看仓库2.2添加仓库2.3更新仓库2.4删除仓库三.Helm基本使用3.1搜索chart应用3.2部署chart应用3.3删除chart应用3.4定制参数部署应用3.5chart应用升级3......