kubernetes-dashboard在谷歌浏览器中访问

接上一篇kubernetes-dashboard搭建,这篇继续来操作让kubernetes-dashboard能在谷歌浏览器Chrome中访问
要在Chrome中访问,我们这里先准备证书

[root@elk-master ~]# openssl genrsa -out dashboard.key 2048
Generating RSA private key, 2048 bit long modulus
....................................................................................................................................................+++
..............................................................+++
e is 65537 (0x10001)
[root@elk-master ~]# openssl req -days 36000   -new -out dashboard.csr    -key dashboard.key   -subj '/CN=**192.168.1.25**'

在这里插入图片描述
生成crt证书

[root@elk-master ~]# openssl x509 -req -in dashboard.csr -signkey dashboard.key -out dashboard.crt

下面把证书生成到k8s中

[root@elk-master ~]# kubectl create secret generic kubernetes-dashboard-certs     --from-file=dashboard.key     --from-file=dashboard.crt      -n kubernetes-dashboard
Error from server (AlreadyExists): secrets "kubernetes-dashboard-certs" already exists

提示已经存在kubernetes-dashboard-certs证书
那我们就先删除原有的kubernetes-dashboard-certs证书

root@elk-master ~]# kubectl delete secret kubernetes-dashboard-certs -n kubernetes-dashboard
secret "kubernetes-dashboard-certs" deleted

接着在执行 kubectl create secret generic kubernetes-dashboard-certs --from-file=dashboard.key --from-file=dashboard.crt -n kubernetes-dashboard
在这里插入图片描述
在这里插入图片描述
输入上篇生成的token就可以正常访问了

Logo

开源、云原生的融合云平台

更多推荐