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

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

被折叠的 条评论
为什么被折叠?



