k8s-仪表盘
1、部署步骤:[root@localhost dashboard]# kubectl create -f dashboard-rbac.yaml[root@localhost dashboard]# kubectl create -f dashboard-secret.yaml[root@localhost dashboard]# kubectl create -f dashboard-confi
·
1、部署步骤:
[root@localhost dashboard]# kubectl create -f dashboard-rbac.yaml
[root@localhost dashboard]# kubectl create -f dashboard-secret.yaml
[root@localhost dashboard]# kubectl create -f dashboard-configmap.yaml
[root@localhost dashboard]# kubectl create -f dashboard-controller.yaml
[root@localhost dashboard]# kubectl create -f dashboard-service.yaml
[root@master01 dashboard]# kubectl get pods -n kube-system -o wide
[root@localhost dashboard]# kubectl get pods,svc -n kube-system
到浏览器上访问:https://14.0.0.13:30001/
[root@master01 dashboard]# vim dashboard-cert.sh
cat > dashboard-csr.json <<EOF
{
"CN": "Dashboard",
"hosts": [],
"key": {
"algo": "rsa",
"size": 2048
},
"names": [
{
"C": "CN",
"L": "BeiJing",
"ST": "BeiJing"
}
]
}
EOF
K8S_CA=$1
cfssl gencert -ca=$K8S_CA/ca.pem -ca-key=$K8S_CA/ca-key.pem -config=$K8S_CA/ca-config.json -profile=kubernetes dashboard-csr.json | cfssljson -bare dashboard
kubectl delete secret kubernetes-dashboard-certs -n kube-system
kubectl create secret generic kubernetes-dashboard-certs --from-file=./ -n kube-system
[root@localhost dashboard]# bash dashboard-cert.sh /root/k8s/k8s-cert/
[root@localhost dashboard]# vim dashboard-controller.yaml
- --auto-generate-certificates 下面添加两行!!!(在本目录下存在这两个证书!!)
- --tls-key-file=dashboard-key.pem
- --tls-cert-file=dashboard.pem
[root@localhost dashboard]# kubectl apply -f dashboard-controller.yaml “确定证书是否生效”
[root@localhost dashboard]# kubectl create -f k8s-admin.yaml
[root@localhost dashboard]# kubectl get secret -n kube-system >>生成的第一行!!!
[root@localhost dashboard]# kubectl describe secret dashboard-admin-token-xxxx -n kube-system
将生成的token码字复制粘贴到浏览器上!!!
2、部署成果:
更多推荐
已为社区贡献6条内容
所有评论(0)