当前位置: 首页 > news >正文

rancher管理多个集群

一、rancher部署

单独部署到一台机器上,及独立于k8s集群之外:

删除所有yum源,重新建yum源:

# 建centos7.9的yum源
# cat CentOS-Base.repo 
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the 
# remarked out baseurl= line instead.
#
#[base]
name=CentOS-$releasever - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/http://mirrors.cloud.aliyuncs.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7#released updates 
[updates]
name=CentOS-$releasever - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/http://mirrors.aliyuncs.com/centos/$releasever/updates/$basearch/http://mirrors.cloud.aliyuncs.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/http://mirrors.aliyuncs.com/centos/$releasever/extras/$basearch/http://mirrors.cloud.aliyuncs.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/centosplus/$basearch/http://mirrors.aliyuncs.com/centos/$releasever/centosplus/$basearch/http://mirrors.cloud.aliyuncs.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/contrib/$basearch/http://mirrors.aliyuncs.com/centos/$releasever/contrib/$basearch/http://mirrors.cloud.aliyuncs.com/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7# 建docker-ce 的yum源
# cat docker-ce.repo 
[docker-ce-stable]
name=Docker CE Stable - $basearch
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/$releasever/$basearch/stable
enabled=1
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg[docker-ce-stable-debuginfo]
name=Docker CE Stable - Debuginfo $basearch
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/$releasever/debug-$basearch/stable
enabled=0
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg[docker-ce-stable-source]
name=Docker CE Stable - Sources
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/$releasever/source/stable
enabled=0
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg[docker-ce-test]
name=Docker CE Test - $basearch
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/$releasever/$basearch/test
enabled=0
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg[docker-ce-test-debuginfo]
name=Docker CE Test - Debuginfo $basearch
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/$releasever/debug-$basearch/test
enabled=0
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg[docker-ce-test-source]
name=Docker CE Test - Sources
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/$releasever/source/test
enabled=0
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg[docker-ce-nightly]
name=Docker CE Nightly - $basearch
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/$releasever/$basearch/nightly
enabled=0
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg[docker-ce-nightly-debuginfo]
name=Docker CE Nightly - Debuginfo $basearch
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/$releasever/debug-$basearch/nightly
enabled=0
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg[docker-ce-nightly-source]
name=Docker CE Nightly - Sources
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/$releasever/source/nightly
enabled=0
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg

# yum install docker

二、安装rancher

# 获取镜像
# docker pull dhub.kubesre.xyz/rancher/rancher:v2.7.1# mkdir /opt/data/rancher_data -p# systemctl start docker# 运行镜像:
# docker run -d --privileged -p 80:80 -p 443:443 -v /opt/data/rancher_data:/var/lib/rancher --restart=always --name rancher-2.7.1 dhub.kubesre.xyz/rancher/rancher:v2.7.1

访问:

192.168.110.40

获取密码<账号为:admin>:# docker logs  ab3d162a9d61 2>&1 | grep "Bootstrap Password:"ab3d162a9d61 这个是容器的id号

三、添加集群

四、在master上执行报错处理

k8s注册到rancher服务器时,用到一个cattle-system命名空间,由于多次试验,在多次删除此命名空间cattle-system是会出现下面状态:

处理方法1:

查看有无绑定资源,无:

# kubectl api-resources -o name --verbs=list --namespaced | xargs -n 1 kubectl get --show-kind --ignore-not-found -n cattle-system

处理方法二:

有占用资源:

# kubectl api-resources -o name --verbs=list --namespaced | xargs -n 1 kubectl get --show-kind --ignore-not-found -n cattle-system

# kubectl get ns cattle-system -o json > cattle-system.json

# kubectl proxy

# curl -k -H "Content-Type: application/json" -X PUT --data-binary @cattle-system.json http://127.0.0.1:8001/api/v1/namespaces/cattle-system/finalize

五、新建cattle-system命名空间报错:

使用下面命令查看是否存在rancher.cattle.io:# kubectl get MutatingWebhookConfiguration
# kubectl get ValidatingWebhookConfiguration
存在则删除:
kubectl delete ValidatingWebhookConfiguration rancher.cattle.io
kubectl delete MutatingWebhookConfiguration rancher.cattle.io

六、在master在此执行:

# curl --insecure -sfL https://192.168.110.40/v3/import/rn4wc2llmvbt7b96pl2pf7dxlksgwcpvcwc9flhzrrjl4mjp8qcqgq_c-m-zvll8v49.yaml | kubectl apply -f -

七、在rancher检查

八、文章参考:

如何删除Terminating状态的命名空间?_云容器引擎 CCE

https://support.huaweicloud.com/cce_faq/cce_faq_00277.html

相关文章:

  • 北京网站建设多少钱?
  • 辽宁网页制作哪家好_网站建设
  • 高端品牌网站建设_汉中网站制作
  • 科技云报道:产业为根大模型应用为擎,容联云推动企业营销服场景重塑
  • 【网络协议】PIM
  • 深入浅出:Scikit-Learn基础教程
  • 初中生物知识点总结(人教版)
  • 市场营销中智能决策支持系统的设计与应用分析
  • C++多态的实现原理
  • python 代码设计贪吃蛇
  • python如何查看类的函数
  • C++学习笔记
  • 自动化回复信息工具的开发分享!
  • 报错:pytest: error: argument -m: expected one argument (via addopts config)
  • 100 个网络基础知识普及,看完成半个网络高手!
  • 程序的控制结构——if-else语句(双分支结构)【互三互三】
  • 语言模型演进:从NLP到LLM的跨越之旅
  • 【C++航海王:追寻罗杰的编程之路】一篇文章带你认识哈希
  • Android单元测试 - 几个重要问题
  • canvas实际项目操作,包含:线条,圆形,扇形,图片绘制,图片圆角遮罩,矩形,弧形文字...
  • Docker 笔记(1):介绍、镜像、容器及其基本操作
  • java正则表式的使用
  • maya建模与骨骼动画快速实现人工鱼
  • PermissionScope Swift4 兼容问题
  • Python 反序列化安全问题(二)
  • Spark RDD学习: aggregate函数
  • yii2中session跨域名的问题
  • 数组的操作
  • 通过获取异步加载JS文件进度实现一个canvas环形loading图
  • 小李飞刀:SQL题目刷起来!
  • ​渐进式Web应用PWA的未来
  • ​软考-高级-系统架构设计师教程(清华第2版)【第12章 信息系统架构设计理论与实践(P420~465)-思维导图】​
  • ​一文看懂数据清洗:缺失值、异常值和重复值的处理
  • # 20155222 2016-2017-2 《Java程序设计》第5周学习总结
  • #QT(智能家居界面-界面切换)
  • (1)(1.8) MSP(MultiWii 串行协议)(4.1 版)
  • (1/2)敏捷实践指南 Agile Practice Guide ([美] Project Management institute 著)
  • (9)目标检测_SSD的原理
  • (Matlab)使用竞争神经网络实现数据聚类
  • (亲测有效)推荐2024最新的免费漫画软件app,无广告,聚合全网资源!
  • (三分钟)速览传统边缘检测算子
  • (十三)MipMap
  • (原創) X61用戶,小心你的上蓋!! (NB) (ThinkPad) (X61)
  • (转)C语言家族扩展收藏 (转)C语言家族扩展
  • (转)可以带来幸福的一本书
  • .equals()到底是什么意思?
  • .gitignore文件使用
  • .NET Compact Framework 3.5 支持 WCF 的子集
  • .net core 6 集成 elasticsearch 并 使用分词器
  • .net core 调用c dll_用C++生成一个简单的DLL文件VS2008
  • .net 按比例显示图片的缩略图
  • .NET精简框架的“无法找到资源程序集”异常释疑
  • .net中调用windows performance记录性能信息
  • @antv/g6 业务场景:流程图
  • [ vulhub漏洞复现篇 ] Apache APISIX 默认密钥漏洞 CVE-2020-13945
  • [ 手记 ] 关于tomcat开机启动设置问题
  • [1]-基于图搜索的路径规划基础
  • [Android学习笔记]ScrollView的使用