Skip to content

Instantly share code, notes, and snippets.

@gnagel
Created June 21, 2019 17:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gnagel/d473d6dce375c08ee68b8857d3209562 to your computer and use it in GitHub Desktop.
Save gnagel/d473d6dce375c08ee68b8857d3209562 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
#
# 1. Install the hyperkit VM for local kubernetes development
#
# > https://github.com/moby/hyperkit
#
brew install hyperkit jq
brew link --overwrite hyperkit
#
# 2. Install the hyperkit <-> Docker drivers
#
brew install docker-machine-driver-hyperkit
sudo chown root:wheel /usr/local/opt/docker-machine-driver-hyperkit/bin/docker-machine-driver-hyperkit
sudo chmod u+s /usr/local/opt/docker-machine-driver-hyperkit/bin/docker-machine-driver-hyperkit
#
# 3. Install minikube
#
# > https://kubernetes.io/docs/tasks/tools/install-minikube/
# > https://github.com/kubernetes/minikube
#
brew cask install minikube
minikube config set vm-driver hyperkit
#
# 3a. Install and deploy the Kubernetes dashboard
#
# > https://kubernetes.io/docs/tasks/access-application-cluster/web-ui-dashboard/
#
kubectl apply -f ./kubernetes/kubernetes-dashboard.yaml
open 'http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/' && kubectl proxy
# Select token
# Create An Authentication Token
# > https://github.com/kubernetes/dashboard#create-an-authentication-token-rbac
kubectl apply -f kubernetes/kubernetes-dashboard-adminuser.yaml
# Copy the token from this command into your browser:
kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep admin-user | awk '{print $1}')
#
# 4. Create a new profile for the `vte_id`:
#
minikube profile vte_id
# > βœ… minikube profile was successfully set to vte_id
# NOTE:
# If you get into trouble and need to remove a profile, you can find the list of profiles here:
# > ls ~/.minikube/profiles/
#
# And delete them with this command:
# > minikube delete -p <profile_name>
#
# 5. Now try starting your minikube cluster:
#
# > https://medium.com/faun/using-minikube-profiles-def2477e968a
#
minikube start -p vte_id --vm-driver=hyperkit [11:27:19]
# πŸ˜„ minikube v1.1.1 on darwin (amd64)
# πŸ”₯ Creating hyperkit VM (CPUs=2, Memory=2048MB, Disk=20000MB) ...
# 🐳 Configuring environment for Kubernetes v1.14.3 on Docker 18.09.6
# πŸ’Ύ Downloading kubelet v1.14.3
# πŸ’Ύ Downloading kubeadm v1.14.3
# 🚜 Pulling images ...
# πŸš€ Launching Kubernetes ...
# βŒ› Verifying: apiserver proxy etcd scheduler controller dns
# πŸ„ Done! kubectl is now configured to use "vte_id"
# On mac the initial cluster will need to be stopped and re-created
# > https://github.com/kubernetes/minikube/issues/1151
#
minikube stop && minikube delete && minikube start
#
# 6. Take a look at the minikube dashboard
#
# > https://medium.com/@wisegain/minikube-cheat-sheet-a273385e66c9
#
kubectl version
# > Client Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.3", GitCommit:"5e53fd6bc17c0dec8434817e69b04a25d8ae0ff0", GitTreeState:"clean", BuildDate:"2019-06-06T01:44:30Z", GoVersion:"go1.12.5", Compiler:"gc", Platform:"darwin/amd64"}
# > Server Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.3", GitCommit:"5e53fd6bc17c0dec8434817e69b04a25d8ae0ff0", GitTreeState:"clean", BuildDate:"2019-06-06T01:36:19Z", GoVersion:"go1.12.5", Compiler:"gc", Platform:"linux/amd64"}
kubectl cluster-info
# > Kubernetes master is running at https://192.168.64.3:8443
# > KubeDNS is running at https://192.168.64.3:8443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
# >
# > To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
#
kubectl cluster-info dump
# ....
kubectl --context=vte_id get componentstatus [10:37:36]
# > NAME STATUS MESSAGE ERROR
# > controller-manager Healthy ok
# > scheduler Healthy ok
# > etcd-0 Healthy {"health":"true"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment