$ sudo snap install microk8s --classic --channel=1.14/stable
Add your user to the 'microk8s' group:
$ sudo usermod -a -G microk8s your-user
Note: The new group will be available on the user's next login.
Accessing Kubernetes: MicroK8s embeds a kubectl and a .kubeconfig file required for accessing the installed MicroK8s. This avoids colliding with any local versions that might be already installed. Check the version installed:
$ microk8s.kubectl version --short
Client Version: v1.14.10
Server Version: v1.14.10
If you would like to use the MicroK8s kubectl and .kubeconfig file locally, you can do the following:
$ sudo snap alias microk8s.kubectl kubectl
$ sudo kubectl config view --raw > $HOME/.kube/config
$ sudo iptables -P FORWARD ACCEPT
$ sudo apt-get install iptables-persistent
Enable the following addons:
$ sudo microk8s.enable dns storage registry
Reboot your machine:
$ sudo reboot
Build your image locally and push it to your local registry
$ docker build . -t localhost:32000/webapp:0.1
$ docker push localhost:32000/webapp:0.1
$ kubectl run webapp --image=localhost:32000/webapp:0.1 --port=8080 --restart=Never
or let's deploy a pod that prints out the "hi there" message by using an image from a public registry:
$ kubectl run busybox --image=busybox --restart=Never /bin/echo "hi there"
$ kubectl logs busybox
hi there
$ kubectl delete pod busybox
- Installation guide from: https://ubuntu.com/kubernetes/install#single-node