How to install kubernetes with kubeadm on ubuntu

Kubernetes is a container orchestration system that manages containers at scale. It was initially developed by Google based on its experience running containers in production.
It’s an open source tool now.

Kubeadm is a single-node kubernetes cluster created by the k8s community to simplify the deployment process. Kubeadm automates the installation and configuration of Kubernetes components such as the API server, Controller Manager, and Kube DNS.

Read Also: Dockerize node js app

Install kubeadm:

In this section, We will install the operating system level packages required by Kubernetes. now, we’re ready to go ahead and do the install.

1. Install Docker:

It is a container runtime and It is the component that runs your containers.

sudo su
apt-get update
apt-get install -y

2. Install HTTPS support (if necessary):

apt-get update
apt-get install -y apt-transport-https

3. Install Curl (if necessary):

apt-get install curl

4. Retrieve the key for the Kubernetes repo and add it to your key manager:

curl -s | apt-key add -

5. Add the kubernetes repo to your system:

cat </etc/apt/sources.list.d/kubernetes.list
deb kubernetes-xenial main

6. Actually, install the three pieces we’ll need, kubeadm, kubelet, and kubectl:

apt-get update
apt-get install -y kubelet kubeadm kubectl

At this point, We have all the tools we need. We can create a cluster and deploy.

Create a cluster:

We can create a single-node kubernetes cluster. Part of this process, We need to choose the network providers. There are several network providers available like flannel, weave, and calico etc.

In this example, We use calico as our network plugin. For Calico, we need to add the –pod-network-cidr switch, as in:

kubeadm init --pod-network-cidr=

It will take some time and eventually return some output.

To make kubectl work for your non-root user, run these commands, which are also part of the kubeadm init output:
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config

Install calico network plugin

kubectl apply -f

Check if all the pods are running

kubectl get pods --all-namespaces

This pods will take some time to start and run

If it is a single node cluster, you need to untaint the master to schedule workloads

kubectl taint nodes --all

Now, the fully functional kubernetes cluster is ready to run your workloads.

Consider reading:  Dockerize bash script

If you have any issues using this tutorial please feel free to comment below.

Leave a Reply

Your email address will not be published.


The reCAPTCHA verification period has expired. Please reload the page.

48-Hour Flash Sale! Courses from just $10.99