当前位置:网站首页>rancher单节点部署和证书问题——筑梦之路
rancher单节点部署和证书问题——筑梦之路
2022-06-09 00:28:00 【筑梦之路】
rancher部署
#创建挂载的目录
mkdir -p /data/etcd
#运行一个容器
docker run -d --name rancher --restart=unless-stopped -p 8080:80 -p 8443:443 -v /data/etcd:/var/lib/rancher/etcd --privileged rancher/rancher:latest
#登陆web
https://192.168.10.100:8443
首次登陆需要设置密码
到此rancher docker方式单节点就部署好了
rancher部署k8s集群
登陆后
主页 —— 添加集群
自定义 填写集群名称、在“kubernetes选项”中选择k8s的版本
在“高级集群选项”中选择是否启用Nginx Ingress。我这里没有选择没有开启,主要是用不上。是否开启请根据您的需求来定。这个设置项后续可以点击rancher界面中此集群的升级按钮进行重新选择。
点击下一步后,进入添加主机命令页面。点选Etcd,Control Plane,Woker三个选项,然后复制下方的命令,到master节点执行
只点选Woker一个选项,然后复制下方的命令,到node节点执行
上述命令实际上就是在各个机器上运行一系列docker容器,整个部署过程大约需要20分钟左右。您可以按照下图的步骤点击进入k8s集群的system项目,观察system相关的命名空间中的资源是否都已经准备好。
左侧状态为Active ,则表示相应的资源准备就绪。当全部资源都是就绪状态,则表示K8S安装完成。
参考资料:https://blog.csdn.net/monarch91/article/details/122763156
rancher添加已有k8s集群
已经部署k8s集群,将已经部署好的k8s集群导入到Rancher环境中
依次点击 "添加集群" -> "导入" -> "添加集群 - Import"
给自己导入的集群起一个名称。比如这里我导入的k8s集群名称设置为"apm-cluster-test"
按照下面的指向,执行第一步骤和第1步骤(因为我这里二进制部署的k8s集群是有证书,所以跳过第1步骤,直接执行第1步骤)
#查看 node节点 kubelet配置中的 USER_ACCOUNT,默认是default-auth
ps -ef | grep kubelet
cat /etc/kubernetes/kubelet.kubeconfig | grep user
#master节点操作
kubectl create clusterrolebinding cluster-admin-binding --clusterrole cluster-admin --user default-auth
curl --insecure -sfL https://192.168.10.100:8443/v3/import/qx7972dgq5876dlvtx66hmb55l49w57tvpr8v58ldwvlk75bb44msn.yaml | kubectl apply -f -
kubectl get pods -n cattle-system
kubectl get daemonset -n cattle-system
观察集群导入后的状态,状态依次从"Waiting" 变为 "Active"
rancher证书过期
报错信息:x509: certificate has expired or is not yet valid
参考资料:
http://kingsd.top/2021/06/02/single-node-cert/
https://docs.rancher.cn/docs/rancher2/trending-topics/certificate-rotation/_index/
rancher 2.5.x
#docker exec 到 Rancher Server 容器内,执行
kubectl --insecure-skip-tls-verify -n kube-system delete secrets k3s-serving
kubectl --insecure-skip-tls-verify delete secret serving-cert -n cattle-system
rm -f /var/lib/rancher/k3s/server/tls/dynamic-cert.json
#重启 rancher-server
#将 rancher ip 重新注入到新证书中,否则业务集群 agent 连接 Rancher Server 会有问题
curl --insecure -sfL https://192.168.10.100:8443/v3
参考资料:
边栏推荐
- Jz73: flipping word sequences
- What is the principle and function of the parental delegation mechanism?
- 【TCP/IP】三次握手过程及原因
- enumeration
- Outsourcing student management system architecture document
- Centernet trains its own data sets, post-processing and parsing
- 0.96oled 4-pin IIC stm32-hal library version (with source code)
- Cloud native technology -- kubedm uses external etcd cluster
- Domestic vscode high-speed download
- How to distinguish IOT network card from mobile SIM card
猜你喜欢

Student management system architecture design document

如何选择正确的消息队列驱动

MySQL-mysql索引详解

外包學生管理系統架構文檔(架構實戰營 模塊三作業)

Final review of introduction to information security at Harbin Institute of Technology

Apifox: saving every minute of the R & D team

Apifox:节省研发团队的每一分钟

Chapter 2 variables, data types, and operators

Application of contact analysis in electronic connector design: analysis of insertion / withdrawal force of three connectors

Multiple registration methods for servlets
随机推荐
排序
js加入收藏
google国内镜像网址收集
日志异常检测-机器学习
AGV电池介绍
Final review of introduction to information security at Harbin Institute of Technology
如何区分物联网卡与手机SIM卡
Member points consumption management system based on SSH
哪一天不写博客了,粉丝会不会好奇我去哪里了
Leetcode 349 intersection of two arrays *easy*) problem solving analysis
Redis persistence
enumeration
Robotics (II): dynamic parameter identification
Do you know these preview capabilities of deveco studio?
GPU rendering pipeline and hardware architecture
js 登录验证
Fractal recursive output
In the most difficult graduation season in history, tens of millions of graduates poured into the talent market. Under the epidemic, how can we "survive the disaster"?
Redis持久化
MySQL-mysql索引详解