How to Get Up and Running With Kubernetes Using MicroK8s
MicroK8s offers a new way to install Kubernetes. In this blog, we provide detailed instructions for installing Kubernetes with MicroK8s.
What Is MicroK8s?
Back to topMicroK8s is a single package of k8s (Kubernetes) for Linux. The MicroK8s snap for Kubernetes was created by Google and Canonical in 2018.
Why Is Kubernetes Called K8s?
Back to topKubernetes is called K8s, because the numeral "8" replaces the last eight letters in Kubernetes.
How to Install Kubernetes With MicroK8s
Here's how to install Kubernetes using MicroK8s.
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.
1. Get MicroK8s
Since this post is about a quick MicroK8s installation, I include some of the snap MicroK8s features prior to the imperative operation commands using the kubectl cli command set.
a. Get and Update the EPEL:
sudo yum install epel-release
b. Install and Update snap core:
sudo yum install snapd
sudo systemctl enable --now snapd.socket
sudo ln -s /var/lib/snapd/snap /snap
2. Use MicroK8s to Install Kubernetes
Now, that the prerequisites are done, we leverage MicroK8s to make Kubernetes installation a snap! sudo snap install microk8s --classic
a. 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.
b. Ensure iptables Are Set to Forward
c. Enable the DNS and the Dashboard
d. Verify the Version
e. Check the Progress of the Cluster on All Namespaces:
microk8s.kubectl get all --all-namespaces
f. Check the Cluster With cluster-info
g. 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 play around with Kubernetes and MicroK8s. 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:
[root@localhost ~]# microk8s.reset
Calling clean_cluster
Cleaning resources in namespace default
endpoints "kubernetes" deleted
secret "default-token-s65lp" deleted
serviceaccount "default" deleted
service "kubernetes" deleted
Cleaning resources in namespace kube-public
Cleaning resources in namespace kube-system
configmap "eventer-config" deleted
service "kubernetes-dashboard" deleted
service "monitoring-grafana" deleted
service "monitoring-influxdb" deleted
deployment.apps "heapster-v1.5.2" deleted
deployment.apps "kube-dns" deleted
deployment.apps "kubernetes-dashboard" deleted
deployment.apps "monitoring-influxdb-grafana-v4" deleted
replicaset.apps "heapster-v1.5.2-6bc7c4965d" deleted
replicaset.apps "kube-dns-6ccd496668" deleted
replicaset.apps "kubernetes-dashboard-654cfb4879" deleted
replicaset.apps "monitoring-influxdb-grafana-v4-6679c46745" deleted
event.events.k8s.io "heapster-v1.5.2-6bc7c4965d-786hb.158a1215c9dbc66a" deleted
event.events.k8s.io "monitoring-influxdb-grafana-v4-6679c46745.158a1215cc8b290c" deleted
configmap "extension-apiserver-authentication" deleted
configmap "heapster-config" deleted
endpoints "monitoring-influxdb" deleted
event "monitoring-influxdb-grafana-v4-6679c46745-7zdfl.158975c8f47bb8c6" deleted
pod "monitoring-influxdb-grafana-v4-6679c46745-7zdfl" deleted
secret "default-token-w4gxg" deleted
serviceaccount "kubernetes-dashboard" deleted
service "monitoring-influxdb" deleted
deployment.apps "monitoring-influxdb-grafana-v4" deleted
replicaset.apps "monitoring-influxdb-grafana-v4-6679c46745" deleted
event.events.k8s.io "monitoring-influxdb-grafana-v4-6679c46745.158a1215cc8b290c" deleted
Waiting for kubernetes resources to be released
[root@localhost ~]#
Back to top
More on Kubernetes and MicroK8s
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.
Back to topGet Help With MicroK8s and Kubernetes
This blog provided tips to help you install Kubernetes with MicroK8s faster. But the fastest way to get up and running with Kubernetes — and revolutionize your business — is to enlist the help of experts.
OpenLogic experts are skilled in Kubernetes. We can help you:
- Migrate to Kubernetes.
- Deploy a fully automated Kubernetes Production Cluster on any substrate of your choice with our Kubernetes Foundations Service.
- Get ongoing enterprise support for Kubernetes.
Talk to one of our Kubernetes experts today to learn how we can help you.
Related Content
- Blog - Top 3 Reasons to Choose Kubernetes For Microservices
- Blog - How to Move a Monolithic Application to Kubernetes With Microservices
- Blog - Granting User Access to Your Kubernetes Cluster
- Blog - What Is Kubernetes?
- Resource - The Complete Guide to Enterprise Cloud