Skip to content

Instantly share code, notes, and snippets.

@kriswill kriswill/README.md
Last active Jul 14, 2018

Embed
What would you like to do?
Procedure to setup a local Kubernetes cluster on Docker for Mac

Procedure to setup a local Kubernetes cluster on Docker for Mac

July 14 2018

  1. Enable Kubernetes in the Docker for Mac Preferences:

Docker for Mac - Preferences

Verify the installation:

→ kubectl cluster-info
Kubernetes master is running at https://localhost:6443
KubeDNS is running at https://localhost:6443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
  1. Install Kubernetes Dashboard:
→ kubectl create -f https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yaml
  1. Setup the admin user:
    # admin-user.yml
    apiVersion: v1
    kind: ServiceAccount
    metadata:
      name: admin-user
      namespace: kube-system
→ kubectl create -f admin-user.yml
  1. Create admin-user cluster role:
    # cluster-admin-role.yml
    apiVersion: rbac.authorization.k8s.io/v1beta1
    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 create -f cluster-admin-role.yml
  1. Get an OAuth Bearer Token
→ kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep admin-user | awk '{print $1}')

output:

Name:         admin-user-token-q5rwv
Namespace:    kube-system
Labels:       <none>
Annotations:  kubernetes.io/service-account.name=admin-user
              kubernetes.io/service-account.uid=c6f56f5b-878f-11e8-9422-025000000001

Type:  kubernetes.io/service-account-token

Data
====
namespace:  11 bytes
token:      <BIG HEX STRING>
ca.crt:     1025 bytes
  1. Start the Kubernetes Dashboard
→ kubectl proxy
  1. Login to the Kubernetes Dashboard

Kubernetes Dashboard Login

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.