在部署好 Kubernetes 单机版的基础上,首先让 apiserver 监听在 0.0.0.0
[root@localhost ~]# vi /etc/kubernetes/apiserver KUBE_API_ADDRESS="--insecure-bind-address=0.0.0.0"
[root@localhost ~]# systemctl restart kube-apiserver
[root@localhost ~]# curl -O https://raw.githubusercontent.com/kubernetes/dashboard/v1.5.1/src/deploy/kubernetes-dashboard.yaml % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 2313 100 2313 0 0 2534 0 --:--:-- --:--:-- --:--:-- 2536
配置 apiserver-host 的地址
... spec: containers: - name: kubernetes-dashboard image: gcr.io/google_containers/kubernetes-dashboard-amd64:v1.5.1 imagePullPolicy: Always ports: - containerPort: 9090 protocol: TCP args: # Uncomment the following line to manually specify Kubernetes API server Host # If not specified, Dashboard will attempt to auto discover the API server and connect # to it. Uncomment only if the default does not work. - --apiserver-host=http://192.168.33.10:8080 ...
[root@localhost ~]# kubectl create -f kubernetes-dashboard.yaml
然后打开服务器 IP 地址:http://192.168.33.10:8080/ui/ 即可看到 Kubernetes Dashboard 界面