Creating a dashboard manually on a system using other booting tools

To run Kubernetes dashboard, we simply fire a command to apply a configuration file, and every resource is created automatically:

$ kubectl create -f
https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yaml
secret "kubernetes-dashboard-certs" created
serviceaccount "kubernetes-dashboard" created
role "kubernetes-dashboard-minimal" created
rolebinding "kubernetes-dashboard-minimal" created
deployment "kubernetes-dashboard" created
service "kubernetes-dashboard" created

Next, let's use the command kubectl proxy to open a gateway connecting localhost and the API server. Then, we are good to access the dashboard via a browser:

$ kubectl proxy
Starting to serve on 127.0.0.1:8001

Once you see a halting result showing, as in the preceding code, you can now access the dashboard by URL: http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/. There, you will see the following screen in your browser:

The login portal of Kubernetes dashboard

To step into our demonstration quickly, we will take the token of an existed service account to log in with. No matter what booting tool you use, leveraging the one created by the dashboard is suitable in every case:

// check the service account in your system
$ kubectl get secret -n kube-system
NAME TYPE DATA AGE
default-token-7jfmd kubernetes.io/service-account-token 3 51d
kubernetes-dashboard-certs Opaque 0 2d
kubernetes-dashboard-key-holder Opaque 2 51d
kubernetes-dashboard-token-jw42n kubernetes.io/service-account-token 3 2d
// grabbing token by checking the detail information of the service account with prefix "kubernetes-dashboard-token-"
$ kubectl describe secret kubernetes-dashboard-token-jw42n -n kube-system
Name: kubernetes-dashboard-token-jw42n
Namespace: kube-system
Labels: <none>
Annotations: kubernetes.io/service-account.name=kubernetes-dashboard
kubernetes.io/service-account.uid=253a1a8f-210b-11e8-b301-8230b6ac4959
Type: kubernetes.io/service-account-token
Data
====
ca.crt: 1066 bytes
namespace: 11 bytes
token:
eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Ii....

Copy the token and paste it into console on the browser, then, click SIGN IN:

Authentication with the token of a service account

Welcome to the dashboard home page:

The home page of the Kubernetes dashboard
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.77.36