What is Kubernetes?
Kubernetes is a free, open source, extensible, and portable platform used to manage containerized services and workload in different types of physical, cloud, and virtual environments. It assists in automation and declarative configuration. It has a vast and speedily expanding ecosystem. Kubernetes tools, support, and services are widely available.
Features of Kubernetes:
Following are the features that Kubernetes supports:
Environment consistency for development, testing, and production
Application Centric Management
High Resource utilization
Can create predictable infrastructure
Enterprise ready features and so much more.
In this article, we will look at how to install single node Kubernetes with the help of a few easy to follow commands. To demonstrate the deployment process, we have used Ubuntu 20.04 as the operating system. Ubuntu is a highly efficient and widely used distribution of Linux. Due to its focus on user friendliness, many people use it as a daily driver. It is also the most used distribution in the tech community.
We will install Kubernetes using the command line interface (also known as Terminal).
Without any further ado, let’s get started.
Following are the steps involved in the deployment process of Kubernetes on Ubuntu:
Step 1: Install MicroK8s
We first need to install MicroK8s on our Ubuntu system. It is a minimal, lightweight, small, and fully conformant distribution of Kubernetes. We are using snapd package manager to install microk8s.
If you don’t have snapd package manager, you can install it from here:
To install microk8s, we will run the following command:
sudo snap install microk8s --classic
Step 2: Grant admin privileges to your user
Admin privilege is required for seamless usage of commands. For that a group is created, which can be joined using the following commands:
sudo usermod -a -G microk8s $USER
sudo chown -f -R $USER ~/.kube
To update the group, you will have to re-enter the session by executing the command mentioned below:
su - $USER
Step 3: Check Kubernetes status
To check the status of Kubernetes while it is being started, run the following command:
microk8s status --wait-ready
Step 4: Enable the services you want
In this step, we will enable the services we want. To see all the available services and optional features, run this command:
microk8s enable –help
To enable a particular service, issue the following command:
microk8s enable dashboard dns ingress
To disable a service, execute the following command:
Microk8s disable <name>
Step 5: Begin using Kubernetes
Now that we are done with the essential configurations, let’s start using Kubernetes.
You can make kubectl the default Kubernetes management tool on your terminal if you use microk8s. To do that, type
Alias mkctl=”microk8s kubectl”. You can also manage other Kubernetes clusters with kubectl by pointing to the respective kubeconfig file through the “—kubeconfig” argument.
microk8s kubectl get all --all-namespaces
Step 6: Access the Kubernetes dashboard
To access the Kubernetes dashboard, you can use the following command:
Step 7: Start Microk8s
You can start a service by running the following command:
Step 8: Stop Microk8s
To stop a service, run the following command:
In today’s guide, we saw in detail how to install Single Node Kubernetes with microk8s on Ubuntu 20.04. We also explored different commands that are used to configure the Kubernetes instance.
We hope you had a great time exploring the guide.
To learn how to use ‘kubectl get’ with the help of a few examples, do give this page a try: