Janrs.com | 杨建勇

  • 首页
  • 站点地图
  • 所有文章
  • 加入学习群
Janrs.com | 杨建勇
Go/Kubernetes/Istio/CloudNative
  1. 首页
  2. k8s/云原生
  3. 正文

k3s/rke2 helm部署rancher

2022年7月19日 100点热度 680人点赞 0条评论

[!TIP]
helm在线部署rancher
使用的是cert-manager自动生成ssl证书
本教程的cert-manager是kubectl apply安装的,不是helm安装

转载请注明出处:https://janrs.com


CPU架构amd64
helm版本v3.9.4
k3s版本1.24.4
rancher版本v2.6
cert-manager版本v1.9.1

helm 部署 rancher

1.下载helm

下载地址

进入下载地址下载对应的版本或者最新版


https://github.com/helm/helm/releases

解压

tar -zxvf helm-v3.9.4-linux-amd64.tar.gz

复制

cd linux-amd64 && cp helm /usr/local/bin && helm version

显示

version.BuildInfo{Version:"v3.9.4", GitCommit:"dbc6d8e20fe1d58d50e6ed30f09a04a77e4c68db", GitTreeState:"clean", GoVersion:"go1.17.13"}

2.安装cert-manager

[!NOTE]
使用自己的证书或外部负载均衡可忽略该步骤
直接从官方把yaml文件下载下来并且替换镜像为自己的阿里私人镜像
v1.9.1版本官网yaml
文件地址:(https://github.com/cert-manager/cert-manager/releases/download/v1.9.1/cert-manager.yaml)

下载后执行安装

kubectl apply -f cert-manager.yaml

查看

kubectl get pods -n cert-manager

显示

NAME                                      READY   STATUS    RESTARTS   AGE
cert-manager-546cbd665f-6f7g7             1/1     Running   0          32m
cert-manager-cainjector-84bb67964-fvpxv   1/1     Running   0          32m
cert-manager-webhook-6896c664f9-z95xq     1/1     Running   0          32m

3.安装rancher2.6

3.1 添加repo源

helm repo add rancher-stable https://releases.rancher.com/server-charts/stable

显示

"rancher-stable" has been added to your repositories

更新

helm repo update

3.2 创建命名空间

创建

kubectl create namespace cattle-system

3.3 安装

执行以下命令安装

[!NOTE]
可以指定--set hostname参数来设置一个访问的域名地址
设置--set nodeSelector来选择部署到指定的节点
参数--set bootstrapPassword设置登录的密码

helm install rancher rancher-stable/rancher \
--namespace cattle-system \
--set hostname=rancher.k3s.com \
--set replicas=1 \
--set 'nodeSelector.node-label-rancher=true' \
--set bootstrapPassword=11@@33qqAA

执行后显示

NAME: rancher
LAST DEPLOYED: Sat Sep 10 14:03:40 2022
NAMESPACE: cattle-system
STATUS: deployed
REVISION: 1
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://rancher.k3s.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://rancher.k3s.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!

查看安装情况

[!NOTE]
执行安装命令后需要等待5-10分钟让服务启动


kubectl get pods -n cattle-system -o wide

显示

NAME                       READY   STATUS    RESTARTS      AGE     IP          NODE         NOMINATED NODE   READINESS GATES
rancher-58b9c7b76d-s9pzg   0/1     Running   1 (47s ago)   6m18s   10.42.4.3   k3s-node01   <none>           <none>

等 5-10 分钟后服务全部部署完后再次查看。或者一边等一边查看

kubectl get pods --all-namespaces
本作品采用 知识共享署名-非商业性使用 4.0 国际许可协议 进行许可
标签: k3s k8s kubeadm kubernetes rancher rke2 云原生CloudNative
最后更新:2023年3月25日

码仔

Janrs.com

点赞
< 上一篇
下一篇 >

文章评论

razz evil exclaim smile redface biggrin eek confused idea lol mad twisted rolleyes wink cool arrow neutral cry mrgreen drooling persevering
取消回复
有关Go/istio/k8s/云原生直接搜
文章目录
  • helm 部署 rancher
    • 1.下载helm
    • 2.安装cert-manager
    • 3.安装rancher2.6
      • 3.1 添加repo源
      • 3.2 创建命名空间
      • 3.3 安装

COPYRIGHT © 2023 Janrs.com | 杨建勇. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang

闽ICP备20002184号