You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Enable Kubernetes

From Docker Preferences, enable Kubernetes.

Check to see if it is running by issuing the following command:

> kubectl get nodes

NAME                 STATUS   ROLES    AGE   VERSION
docker-for-desktop   Ready    master   5h    v1.10.3


Install the Dashboard

> kubectl create -f https://raw.githubusercontent.com/kubernetes/dashboard/master/aio/deploy/recommended/kubernetes-dashboard.yaml


Verify that it is installed:

> kubectl get pods --all-namespaces -o wide


NAMESPACE     NAME                                         READY   STATUS    RESTARTS   AGE   IP             NODE
docker        compose-74649b4db6-zpb5t                     1/1     Running   0          5h    10.1.0.3       docker-for-desktop
docker        compose-api-8477889868-jfzph                 1/1     Running   0          5h    192.168.65.3   docker-for-desktop
kube-system   etcd-docker-for-desktop                      1/1     Running   0          5h    192.168.65.3   docker-for-desktop
kube-system   kube-apiserver-docker-for-desktop            1/1     Running   0          5h    192.168.65.3   docker-for-desktop
kube-system   kube-controller-manager-docker-for-desktop   1/1     Running   0          5h    192.168.65.3   docker-for-desktop
kube-system   kube-dns-86f4d74b45-txr8w                    3/3     Running   0          5h    10.1.0.2       docker-for-desktop
kube-system   kube-proxy-q5vrd                             1/1     Running   0          5h    192.168.65.3   docker-for-desktop
kube-system   kube-scheduler-docker-for-desktop            1/1     Running   0          5h    192.168.65.3   docker-for-desktop
kube-system   kubernetes-dashboard-669f9bbd46-pxd4x        1/1     Running   0          50s   10.1.0.4       docker-for-desktop


Create a user:

vi dashboard-adminuser.yaml

apiVersion: v1
kind: ServiceAccount
metadata:
  name: admin-user
  namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: admin-user
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: cluster-admin
subjects:
- kind: ServiceAccount
  name: admin-user
  namespace: kube-system


> kubectl apply -f dashboard-adminuser.yaml

serviceaccount/admin-user created
clusterrolebinding.rbac.authorization.k8s.io/admin-user created


Get the Token for the created user

> kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep admin-user | awk '{print $1}')

Name:         admin-user-token-shqsn
Namespace:    kube-system
Labels:       <none>
Annotations:  kubernetes.io/service-account.name: admin-user
              kubernetes.io/service-account.uid: 8ab8e997-1069-11e9-9ec0-025000000001

Type:  kubernetes.io/service-account-token

Data
====
token:      eyJhbGciOiJSUzI1NiIsImtpZCI6IiJ9.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrdWJlLXN5c3RlbSIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJhZG1pbi11c2VyLXRva2VuLXNocXNuIiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQubmFtZSI6ImFkbWluLXVzZXIiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC51aWQiOiI4YWI4ZTk5Ny0xMDY5LTExZTktOWVjMC0wMjUwMDAwMDAwMDEiLCJzdWIiOiJzeXN0ZW06c2VydmljZWFjY291bnQ6a3ViZS1zeXN0ZW06YWRtaW4tdXNlciJ9.MejrO_QQmPOg-ga5wXatkBBsTD5NbT0GHyIdxK5Ki3L4Yt1ZjTB8cCmhC2cN7kpus6RXN8fZpeB72UohSd1JBOJbJ9QFobSfEXXgKWD9r366hkuqP3lObTUexNDTsVlx12WUD6Vp_QAkq8ItIQ3o6xdeA2udhrAB8E55vPhK2PzyuaLHkkT-87CmG1amdn9mpZGv4FNHUvS7TYHvHs2ShisWZgLsC9hF8t_TngGWcUA5OXqH_5CzdLAYj3f2qXwXmbYiwrHT9T8PL3gchDDDuvhDxjesWqdWRjKYDU1mJ5oNskEiBQcRF0mOwl5BlZm8VwNAV1CUdKKXeSeI7_cZ6g
ca.crt:     1025 bytes
namespace:  11 bytes



Start the proxy

> kubectl proxy

Starting to serve on 127.0.0.1:8001


Open your browser

Navigate to:

http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/#!/login


Sign in using the token previously retrieved.



References

ReferenceURL
Docker - Deploy on Kuberneteshttps://docs.docker.com/docker-for-mac/kubernetes/
Kubernetes Dashboardhttps://github.com/kubernetes/dashboard




  • No labels