Kubeadm is a tool used to build Kubernetes (K8s) clusters. Kubeadm performs the actions necessary to get a
minimum viable cluster up and running quickly. By design, it cares only about bootstrapping, not about
provisioning machines (underlying worker and master nodes). Kubeadm also serves as a building block for
higher-level and more tailored tooling.
Kubeadm’s Features
Common use cases for Kubeadm include testing, creating baselines for more advanced K8s deployments, and
providing new K8s users a simple starting point for cluster configuration. The specific features that make
kubeadm useful in those applications are:
Quick minimum viable cluster creation
Kubeadm is designed to have all the components you need in one place in one cluster regardless of
where you are running them.
Portable
Kubeadm can be used to set up a cluster anywhere whether it's your laptop, a Raspberry Pi, or public
cloud infrastructure.
Local development
As Kubeadm creates clusters with minimal dependencies and quickly, it's an ideal candidate for
creating disposable clusters on local machines for development and testing needs.
Building block for other tools
Kubeadm is not just a K8s installer. It also serves as a building block for other tools like
Kubespray.
Kubeadm vs kOps vs Kubespray
Of course, kubeadm isn’t the only tool available to deploy a K8s cluster. kOps and Kubespray are two popular
tools for the same general use case. However, each tool offers different functionality that makes them ideal
for different applications. Before we dive into how to create the Kubeadm cluster, let's take a closer look
at how it stacks up to the alternatives.
Identify under/over-provisioned K8s resources and use Terraform to auto-optimize
As we can see, Kubeadm is a more lightweight tool that doesn’t attempt to do everything kOps or Kubespray
can. This is consistent with its focus on minimum viable clusters.
The Problems kubeadm Solves
With more robust tools available, why use kubeadm? In simple terms: because it reduces complexity and makes
it easy to get a usable K8s cluster deployed.
Provisioning a Kubernetes cluster with other tools takes time, server resources, and expertise. Kubeadm is
easy to get started with and lightweight enough to be used on local machines. As a result, many developers
and testers prefer kubeadm for cases that require the fast deployment of a cluster with minimal resources.
How to Create a Kubernetes Cluster with kubeadm
Now that we know what kubeadm is, let’s walk through how to use it to create a Kubernetes cluster. In this
example, we will create a 3 node cluster with 1 master node and 2 worker nodes.
1. Install Docker on All Three Nodes
Since kubeadm does not create infrastructure, as a prerequisite we need to provision 3 machines that will
form the cluster.
Note: This command prints very important information which will be used later by worker nodes to
join the master and form a cluster. The output should look something like this:
Next, we’ll check the nodes in the cluster with kubectl get nodes. At this point there
should be only 1 node (the master node). Here’s an example of the expected output (don’t worry about
the “NotReady” status, we’ll get to that soon!):
> kubectl get nodes
NAME STATUS ROLES AGE VERSION
ip-10-0-1-101 NotReady master 63s v1.14.5
4. Add the Two Worker Nodes to the Cluster
With the master node created, we can add our worker nodes to the cluster.
After running join command on both the worker nodes, go to master nodes and run the
kubectl get nodes command to verify that worker nodes have joined the cluster:
> kubectl get nodes
NAME STATUS ROLES AGE VERSION
ip-10-0-1-101 NotReady master 2m41s v1.14.5
ip-10-0-1-102 NotReady 23s v1.14.5
ip-10-0-1-103 NotReady 7s v1.14.5
We can see the nodes have joined the cluster. Now let's take care of that NotReady status...
Identify under/over-provisioned K8s resources and use Terraform to auto-optimize
Wait a few seconds run kubectl get nodes and all the nodes should have a “Ready”
status:
> kubectl get nodes
NAME STATUS ROLES AGE VERSION
ip-10-0-1-101 Ready master 4m19s v1.14.5
ip-10-0-1-102 Ready 2m1s v1.14.5
ip-10-0-1-103 Ready 105s v1.14.5
That’s it! We now have a working K8s cluster!
Free 45 minute K8s optimization consulting if you run more than 1,000 containers
Kubeadm is a great tool when used for its intended applications. Here are three best practices to keep in
mind to ensure you’re using the right tool for the job and getting the most out of kubeadm.
Don’t use kubeadm for production clusters that require autoscaling: Generally, kubeadm should not be
used for production clusters because it does not come with node autoscaling/cluster autoscaling
functionality. This is because node autoscaling requires managing underlying infrastructure and
hardware, which kubeadm leaves to other tools.
Take frequent backups of etcd: By default, kubeadm does not have a multi-etcd cluster for storing
cluster state. Be sure to take regular backups of etcd in case a failure occurs.
Keep track of machines/nodes: Kubeadm can not turn machines off when they are not in use. As a
result, you’ll need to use an external solution to track worker nodes and their resource utilization
to cluster optimize cost and efficiency.
Like this article?
Subscribe to our LinkedIn Newsletter to receive more educational content
We’re glad you are here! Densify customizes your experience by enabling cookies that help us understand your interests and recommend related information. By using our sites, you consent to our use of cookies. Learn more.