什么是rancher?
rancher是一个开源的企业级多集群的k8s管理平台
rancher和k8s的区别
都是为了容器的调度和编排系统,但是rancher不仅能够调度,还能管理k8s集群,自带监控(普罗米修斯)
实验部署
实验架构
20.0.0.70 master
20.0.0.71 node01
20.0.0.72 node02
20.0.0.33 Rancher节点master node01 node02节点
docker pull rancher/rancher-agent:v2.5.7在Rancher节点
docker pull rancher/rancher:v2.5.7
docker run -d --restart=unless-stopped -p 80:80 -p 443:443 --privileged --name rancher rancher/rancher:v2.5.7页面访问
20.0.0.33
创建集群
首页----> 创建集群--->导入---> 输入集群名称--->复制curl --insecure -sfL https://20.0.0.33/v3/import/cj7c87cxbrlgfwlchqjgpbrvqfvmjrgtgw9hfsvgqttr262dw6rjvz_c-52bpg.yaml | kubectl apply -f - 到master主节点上执行(执行2次)
[root@master01 hpa]# curl --insecure -sfL https://20.0.0.33/v3/import/62qbd5h2tl85qg2szqmb6q8mgqqzkdzvbl9g2vr2v542jbtnhdp6pk_c-nf2x2.yaml | kubectl apply -f -
error: no objects passed to apply
[root@master01 hpa]# curl --insecure -sfL https://20.0.0.33/v3/import/62qbd5h2tl85qg2szqmb6q8mgqqzkdzvbl9g2vr2v542jbtnhdp6pk_c-nf2x2.yaml | kubectl apply -f -
clusterrole.rbac.authorization.k8s.io/proxy-clusterrole-kubeapiserver created
clusterrolebinding.rbac.authorization.k8s.io/proxy-role-binding-kubernetes-master created
namespace/cattle-system created
serviceaccount/cattle created
clusterrolebinding.rbac.authorization.k8s.io/cattle-admin-binding created
secret/cattle-credentials-11baf69 created
clusterrole.rbac.authorization.k8s.io/cattle-admin created
deployment.apps/cattle-cluster-agent created
查看集群的节点
配置集群
启动集群的监控
创建命名空间
创建deployment
设置标签
健康检查
容器配置
创建service
页面访问
创建ingress
创建成功