How to Get Up and Running With Kubernetes Using MicroK8s
Last year, Google and Canonical created the MicroK8s snap for Kubernetes. According to its website, the MicroK8s snap is “A single package of k8s that installs on 42 flavours of Linux. Made for developers and great for appliances.”
Step-by-Step Instructions: Get up and Running With Kubernetes
In this post, I’ll show you an incredibly fast method to get up and running on a Kubernetes (“k8s”) cluster.
Note: Securing your cluster properly is very important. At Tesla, an unsecured administrative console for Kubernetes caused one if its cloud accounts to be compromised. In addition, unsuspecting folks had their microk8s cluster compromised, then used to mine bitcoin.
Since this post is about a quick k8s installation, I include some of the snap microk8s features prior to the imperative operation commands using the kubectl cli command set.
1. Get and Update the EPEL:
sudo yum install epel-release
2. Install and update snap core:
sudo yum install snapd
sudo systemctl enable --now snapd.socket
sudo ln -s /var/lib/snapd/snap /snap
Now, that the prerequisites are done, we leverage MicroK8s to make Kubernetes installation a snap!
sudo snap install microk8s --classic
Check status of the freshly installed MicroK8s implementation.
You can create an alias for kubectl, docker if typing 9 extra characters is undesirable. I chose to leave it as is, as the images below can attest.
On the command span info MicroK8s we are able to see that in the snap channel, the latest version of Kubernetes has been updated.
Ensure iptables are set to forward.
Enable the DNS and the dashboard.
Verify the version.
Check the progress of the cluster on all namespaces:
microk8s.kubectl get all --all-namespaces
Check the cluster with cluster-info.
View the configuration of the new cluster.
As Kubernetes is primarily a cluster management framework, get the list of clusters and verify the cluster name within the specific context.
It uses the following API versions:
Finally, feel free to muck around. It’s allowed, really!
Don’t worry if the cluster becomes unhealthy. You can reset the cluster using:
microk8s.reset The following was edited to represent the reset steps:
Now that I’ve shown you how to get up and running with Kubernetes, let me tell you about the real fun: making an already unhealthy cluster healthy. On the Ubuntu blog, there's an interesting post on setting up Kubernetes a Raspberry Pi with MicroK8s. Also, I found a post that lists projects using MicroK8s.
We’re Here to Help
OpenLogic's open source architects are available to assist you with this and other popular open source solutions. Contact us to learn more about our solutions.