1. 程式人生 > >Kubernetes dashboard安裝

Kubernetes dashboard安裝

manifest openss hold grep server ice and strong fin

1. To download Dashboard plugin deployment YAML file from internet.

#cd /home

#mkdir k8s

#cd k8s

# wget https://raw.githubusercontent.com/kubernetes/dashboard/v1.10.1/src/deploy/recommended/kubernetes-dashboard.yaml

##官方鏈接https://kubernetes.io/docs/tasks/access-application-cluster/web-ui-dashboard/

2. To Create certificate for dashboard

# mkdir certs

# openssl req -nodes -newkey rsa:2048 -keyout certs/dashboard.key -out certs/dashboard.csr -subj "/C=/ST=/L=/O=/OU=/CN=kubernetes-dashboard"

# openssl x509 -req -sha256 -days 365 -in certs/dashboard.csr -signkey certs/dashboard.key -out certs/dashboard.crt

# kubectl create secret generic kubernetes-dashboard-certs --from-file=certs -n kube-system

3.To modify the default kubernetes-dashboard.yaml file, Modify the rbac parameter, and add type: NodePort to expose Dashboard service can be accessed by outside.

# vi kubernetes-dashboard.yaml

技術分享圖片

技術分享圖片

4.To create Dashboard

# kubectl create -f kubernetes-dashboard.yaml

技術分享圖片

5.To get NodePort and access token.

# kubectl -n kube-system get secret | grep kubernetes-dashboard

技術分享圖片

# kubectl describe -n kube-system secret/kubernetes-dashboard-token-xxxxx

技術分享圖片

# kubectl get svc -n kube-system (Dashboard runs on port 32580)

技術分享圖片

6. To access the Dashboard (https://192.168.4.200:32580)

技術分享圖片

技術分享圖片

技術分享圖片

Note:

1) If you login the dashboard , you find the dashboard show error like “User "system:anonymous" cannot get at the cluster scope.”,

技術分享圖片

# vi /etc/kubernetes/manifests/kube-apiserver.yaml

添加如下參數:

--anonymous-auth=false

技術分享圖片

2) Kube-apiserver down after installing the kubernetes dashboard?

Change or add bellow parameters.(bellow is for only one master lab environment)

- --insecure-bind-address=127.0.0.1

- --insecure-port=8080

livenessProbe:

failureThreshold: 8

httpGet:

host: 127.0.0.1

path: /healthz

port: 8080

scheme: HTTP

initialDelaySeconds: 15

timeoutSeconds: 15

Kubernetes dashboard安裝