k8s dashboard 更换证书后,请求超时
已经添加了 type: NodePort ,端口启动成功,但是访问超时1、生成证书#!/bin/bashopenssl genrsa -out ca.key 2048openssl req -new -x509 -key ca.key -out ca.crt -days 3650 -subj "/C=CN/ST=HB/L=WH/O=DM/OU=YPT/CN=CA"openssl g...
已经添加了 type: NodePort ,端口启动成功,但是访问超时
1、生成证书
#!/bin/bash
openssl genrsa -out ca.key 2048
openssl req -new -x509 -key ca.key -out ca.crt -days 3650 -subj "/C=CN/ST=HB/L=WH/O=DM/OU=YPT/CN=CA"
openssl genrsa -out dashboard.key 2048
openssl req -new -sha256 -key dashboard.key -out dashboard.csr -subj "/C=CN/ST=HB/L=WH/O=DM/OU=YPT/CN=$1"
echo "extensions = san
[san]
keyUsage = digitalSignature
extendedKeyUsage = clientAuth,serverAuth
subjectKeyIdentifier = hash
authorityKeyIdentifier = keyid,issuer
subjectAltName = IP:$1,IP:127.0.0.1,DNS:$1,DNS:localhost
" > dashboard.cnf
openssl x509 -req -sha256 -days 3650 -in dashboard.csr -out dashboard.crt -CA ca.crt -CAkey ca.key -CAcreateserial -extfile dashboard.cnf
rm -f dashboard.csr dashboard.cnf ca.srl ca.key
echo "create completed"
bash xxx.sh 192.168.1.xxx即可
2、创建命名空间(这句才是重点,后面的绑定证书要对应上)
kubectl create namespace kubernetes-dashboard
3、绑定证书
kubectl create secret generic kubernetes-dashboard-certs --from-file="tls/dashboard.crt,tls/dashboard.key" -n kubernetes-dashboard
4、直接启动。
kubectl create -f xxx.yaml
5、token查询方法待续。。。
细节:
kubernetes-dashboard 命名空间名称是 yaml文件中的,我的是recommended.yaml
yaml文件中只需要添加type:nodeport即可。不需要做其它改动
kubectl delete -f xxx.yaml 会删掉secret配置,需要先 绑定证书,再create -f
更多推荐
所有评论(0)