rancher接管k8s集群

本文详细介绍了如何使用Rancher 2.5.7接管Kubernetes集群,包括拉取rancher-agent镜像、导入资源文件、创建角色与绑定、配置cattle-system和部署cattle-cluster-agent,以及设置必要的权限和网络规则。

rancher接管集群与使用

[root@k8s-master ~]# docker pull rancher/rancher-agent:v2.5.7

[root@rancher ~]# docker pull rancher/rancher:v2.5.7
 

[root@rancher ~]# docker run -d --restart=unless-stopped -p 80:80 -p 443:443 --privileged --name rancher rancher/rancher:v2.5.7
 
[root@rancher ~]# docker ps -a|grep rancher
7e4498d84972        rancher/rancher:v2.5.7   "entrypoint.sh"     6 seconds ago       Up 5 seconds        0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp   rancher

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

再master上执行

[root@master ~]# curl --insecure -sfL https://192.168.1.100/v3/import/kh4t7pmn484cm5cbvtzqdhqxkddpqqt9pwdlpkc49t24ts42k9wlqv_c-zjqlm.yaml | kubectl apply -f -
error: no objects passed to apply       #第一次执行失败了,再次执行下,可以看下这个yaml
[root@master ~]# curl --insecure -sfL https://192.168.1.100/v3/import/kh4t7pmn484cm5cbvtzqdhqxkddpqqt9pwdlpkc49t24ts42k9wlqv_c-zjqlm.yaml

---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: proxy-clusterrole-kubeapiserver
rules:
- apiGroups: [""]
  resources:
  - nodes/metrics
  - nodes/proxy
  - nodes/stats
  - nodes/log
  - nodes/spec
  verbs: ["get", "list", "watch", "create"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: proxy-role-binding-kubernetes-master
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: proxy-clusterrole-kubeapiserver
subjects:
- apiGroup: rbac.authorization.k8s.io
  kind: User
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值