Vagrant-based script for starting local Kubernetes cluster accessible from kubectl on the host machine
Download and install Vagrant (https://www.vagrantup.com/docs/installation/).
Run ./kube-up.sh
to create or resume suspended VM with Kubernetes cluster.
At the end of running script, follow instructions:
====================================================================
Now run the following command to setup kubectl context for localkube
export KUBECONFIG=${HOME}/.kube/config:$HOME/.kube/localkube
Once you've done this, you can use this context via --context flag:
kubectl --context localkube get pods
And if you want to make 'localkube' your default context, run:
kubectl config use-context localkube
====================================================================
Once you finished, you should be able to run commands agaist locally running Kubernetes
cluster using kubectl
the same way you normally do for remote clusters, for example:
kubectl get pods
Run ./kube-down.sh
Run ./kube-destroy.sh
The Vagrantfile
used in this project is based on @lizrice's gist with minor tweaks and extra automation of manual steps described in https://medium.com/@lizrice/kubernetes-in-vagrant-with-kubeadm-21979ded6c63