部署命令nginx
docker run -d --net=host -v /etc/kubernetes:/etc/kubernetes -v /data/certs:/certs -v /data/tmp:/tmp -e KUBERNETES_SERVICE_HOST=192.168.70.55 -e KUBERNETES_SERVICE_PORT=6443 k8s.gcr.io/kubernetes-dashboard-amd64:v1.8.3 --kubeconfig=/etc/kubernetes/kubelet.kubeconfig --bind-address=192.168.70.206 --port=443 --enable-insecure-login=true --heapster-host=http://192.168.70.11:80 --tls-key-file=192.168.70.206.key --tls-cert-file=192.168.70.206.crt
訪問地址 https://192.168.70.206 私鑰和自有簽名 https://raw.githubusercontent.com/michaelliao/itranswarp.js/master/conf/ssl/gencert.shgit
#!/bin/sh # create self-signed server certificate: read -p "Enter your domain [www.example.com]: " DOMAIN echo "Create server key..." openssl genrsa -des3 -out $DOMAIN.key 1024 echo "Create server certificate signing request..." SUBJECT="/C=US/ST=Mars/L=iTranswarp/O=iTranswarp/OU=iTranswarp/CN=$DOMAIN" openssl req -new -subj $SUBJECT -key $DOMAIN.key -out $DOMAIN.csr echo "Remove password..." mv $DOMAIN.key $DOMAIN.origin.key openssl rsa -in $DOMAIN.origin.key -out $DOMAIN.key echo "Sign SSL certificate..." openssl x509 -req -days 3650 -in $DOMAIN.csr -signkey $DOMAIN.key -out $DOMAIN.crt echo "TODO:" echo "Copy $DOMAIN.crt to /etc/nginx/ssl/$DOMAIN.crt" echo "Copy $DOMAIN.key to /etc/nginx/ssl/$DOMAIN.key" echo "Add configuration in nginx:" echo "server {" echo " ..." echo " listen 443 ssl;" echo " ssl_certificate /etc/nginx/ssl/$DOMAIN.crt;" echo " ssl_certificate_key /etc/nginx/ssl/$DOMAIN.key;" echo "}"
運行./gencert.sh 192.168.70.206 生成的192.168.70.206.crt下載下來,開始導入到chrome就能夠安全的使用面板了, 面板只支持https,http不支持token驗證跳轉,而且對firefox的兼容極差 k8s的面板最好用chrome訪問github