转接上文:多节点部署k8s(7):创建UI界面

https://192.168.100.30:30001/
1、生成需要的证书
[root@k8s-master1 k8s页面]# 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@k8s-master1 k8s页面]# vim dashboard-controller.yaml
[root@k8s-master1 k8s页面]# bash dashboard-cert.sh /master/k8s
[root@k8s-master1 k8s页面]# ls
	dashboard-cert.sh          dashboard-csr.json   dashboard-secret.yaml
	dashboard-configmap.yaml   dashboard-key.pem    dashboard-service.yaml
	dashboard-controller.yaml  dashboard.pem        k8s-admin.yaml
	dashboard.csr              dashboard-rbac.yaml
[root@k8s-master1 k8s页面]# vim dashboard-controller.yaml
	 46           # PLATFORM-SPECIFIC ARGS HERE
	 47           - --auto-generate-certificates
	 48           - --tls-key-file=dashboard-key.pem
	 49           - --tls-cert-file=dashboard.pem
	 50         volumeMounts:
2、重新生成
[root@k8s-master1 k8s页面]# kubectl apply -f dashboard-controller.yaml
[root@k8s-master1 k8s页面]# kubectl get secret -n kube-system
	NAME                               TYPE                                  DATA   AGE
	dashboard-admin-token-tpbnt        kubernetes.io/service-account-token   3      4d18h
	default-token-h94dv                kubernetes.io/service-account-token   3      7d
	kubernetes-dashboard-certs         Opaque                                11     12m
	kubernetes-dashboard-key-holder    Opaque                                2      4d19h
	kubernetes-dashboard-token-x9f9h   kubernetes.io/service-account-token   3      4d19h

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

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐