K8S集群内部署Rancher2.5.16
一、环境
k8s:1.18.20
OS:Anolis OS 7.9
rancher:2.5.16
参考官网部署文档:https://ranchermanager.docs.rancher.com/zh/v2.6/pages-for-subheaders/install-upgrade-on-a-kubernetes-cluster
二、部署cert-manager
参考:k8s1.18.20:cert-manager 1.8 安装部署
三、部署Rancher2.5.16
3.1、添加 Helm Chart 仓库
helm repo add rancher-stable https://releases.rancher.com/server-charts/stable
3.2、创建名称空间
kubectl create namespace cattle-system
3.3、部署rancher
helm install rancher rancher-stable/rancher --version 2.5.16 \
--namespace cattle-system --create-namespace \
--set hostname=rancher.demo.cn \
--set bootstrapPassword=admin \
--set replicas=1
3.4、检查rancher是否正常启动
[root@k8s-node rancher]# kubectl get pod -o wide -n cattle-system
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
cattle-cluster-agent-5d576f784b-j6r5z 1/1 Running 0 4h36m 10.42.113.161 k8s-node <none> <none>
cattle-cluster-agent-7f6d48d9bf-pf695 0/1 CrashLoopBackOff 63 4h36m 10.42.113.162 k8s-node <none> <none>
rancher-55d45d894-7kkn8 1/1 Running 0 4h55m 10.42.113.143 k8s-node <none> <none>
rancher-55d45d894-bg2kx 1/1 Running 0 4h55m 10.42.113.144 k8s-node <none> <none>
rancher-55d45d894-fg7jr 1/1 Running 0 4h55m 10.42.113.137 k8s-node <none> <none>
rancher-webhook-6cdc7f756b-4bcjv 1/1 Running 0 4h49m 10.42.113.158 k8s-node <none> <none>
3.5、访问Rancher
客户端设置本机hosts 域名指向K8S ingress服务器。
例如:172.27.1.47 rancher.demo.cn
3.6、设置Rancher地址
注:设置rancher地址为:https://rancher 方便agent可以访问到rancher!
3.7、Rancher导入外部集群
master服务器设置本机hosts 添加rancher域名ip。
需要注意的事项
红框中的地址用域名替换!确保master本机可以访问域名。