Ubuntu 20.04
Sponsored Link

Kubernetes : Enable Dashboard
Enable Dashboard to manage Kubernetes Cluster on Web UI.
This example is based on the environment like follows.
           |                           |                          |
       eth0|              eth0|             eth0|
+----------+-----------+   +-----------+----------+   +-----------+----------+
|   [ dlp.srv.world ]  |   | [ node01.srv.world ] |   | [ node02.srv.world ] |
|      Master Node     |   |      Worker Node     |   |      Worker Node     |
+----------------------+   +----------------------+   +----------------------+

[1] Enable Dashboard on Master Node.
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.3/aio/deploy/recommended.yaml

namespace/kubernetes-dashboard created
serviceaccount/kubernetes-dashboard created
service/kubernetes-dashboard created
secret/kubernetes-dashboard-certs created
secret/kubernetes-dashboard-csrf created
secret/kubernetes-dashboard-key-holder created
configmap/kubernetes-dashboard-settings created
role.rbac.authorization.k8s.io/kubernetes-dashboard created
clusterrole.rbac.authorization.k8s.io/kubernetes-dashboard created
rolebinding.rbac.authorization.k8s.io/kubernetes-dashboard created
clusterrolebinding.rbac.authorization.k8s.io/kubernetes-dashboard created
deployment.apps/kubernetes-dashboard created
service/dashboard-metrics-scraper created
deployment.apps/dashboard-metrics-scraper created
[2] Add an account for Dashboard management.
kubectl create serviceaccount -n kubernetes-dashboard admin-user

serviceaccount/admin-user created
vi rbac.yml
# create new

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
  name: admin-user
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: cluster-admin
- kind: ServiceAccount
  name: admin-user
  namespace: kubernetes-dashboard

kubectl apply -f rbac.yml

clusterrolebinding.rbac.authorization.k8s.io/admin-user created
# confirm security token of the account

# it is the second column value on [token:] line

kubectl -n kubernetes-dashboard describe secret $(kubectl -n kubernetes-dashboard get secret | grep admin-user | awk '{print $1}')

Name:         admin-user-token-mfxbj
Namespace:    kubernetes-dashboard
Labels:       <none>
Annotations:  kubernetes.io/service-account.name: admin-user
              kubernetes.io/service-account.uid: 0386627d-61be-4e49-b8a4-565eff4ab6cc

Type:  kubernetes.io/service-account-token

ca.crt:     1025 bytes
namespace:  20 bytes
token:      eyJhbGciOiJSUzI1NiIsImtpZCI6IlJnSUVrV0ZXUVM5WmpVX0hhbG9UaThaUG9lcGZf.....

# run kube-proxy

kubectl proxy

Starting to serve on
# if access from other client hosts, set port-forwarding

kubectl port-forward -n kubernetes-dashboard service/kubernetes-dashboard --address 10443:443

Forwarding from -> 8443
If you run [kubectl proxy], access to the URL below with an Web browser on Localhost.
⇒ http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/
If you set port-fowarding, access to the URL below on a client computer in your local network.
⇒ https://(Master Node Hostname or IP address):(setting port)/
After displaying following form, Copy and paste the security token you confirmed on [2] to [Enter token] section and Click [Sing In] button.
[4] After authentication successfully passed, Kubernetes Cluster Dashboard is displayed.
The example screen below is the environment that Metrics Server also has been deployed.
Matched Content