Effortless Kubernetes Deployment on Ubuntu

Setting up a Kubernetes cluster on Ubuntu involves several steps that ensure a seamless and robust container orchestration environment. This guide will walk you through the process of setting up a Kubernetes cluster on Ubuntu, including the installation of Docker and the essential components of Kubernetes, configuration of network plugins like Calico, and expanding the cluster with kubeadm join.

Step 1: Preparing the System

Before setting up Kubernetes, it is essential to prepare the system by performing some fundamental tasks such as renaming the host, disabling swap, and updating the hostname. This ensures that the environment is optimal for container orchestration. To begin with the initial setup of Kubernetes on Ubuntu, let’s execute the following commands one by one:

Rename the host to a more descriptive name:

$ sudo sed ‘s/hostname/’ /etc/hostname.conf ‘new-hostname’

Disable swap to prevent performance issues:

$sudo swaptopu disabled

Update hostname to reflect the new name:

$sudo hostname -t new-hostname

Step 2: Installing Docker and Kubernetes Components

To install Kubernetes, you need to have Docker and the essential components of Kubernetes already installed on your system. Here are the installation commands for each component:

Install Docker:

$sudo apt-get docker.io

Install Calico (a network plugin):

$sudo apt-get calico

Step 3: Configuring Network Plugins like Calico

To ensure efficient communication between pods, it is crucial to configure a network plugin such as Calico. Calico is a popular choice due to its simplicity and stability. Follow these steps to set up Calico:

Download the custom resources YAML file for Calico:

$curl https://raw.githubusercontent.com/projectcalico/calico/v3.26.1/manifests/custom-resources.yaml -o

Create the Calico operator:

$kubectl create -f custom-resources.yaml

Step 4: Expanding the Cluster with kubeadm join

To incorporate worker nodes into the cluster, you need to use the kubeadm join command with specific variable values obtained from the initial setup steps. If you did not note down the token or it has expired, you can regenerate it using the following command:

Generate a new token:

$kubeadm token create –print-join-command

This will output the complete join command, including the token and discovery token CA certificate hash required for secure connection to the master node. To incorporate worker nodes into the cluster, execute the Following Command:

Join the worker nodes to the cluster using the join command:

$kubeadm join –token –discovery-token-ca-cert-hash

Replace with the actual token produced during the initial setup and with the appropriate discovery Token CA Certificate Hash obtained during the same process.

By following these steps, you can successfully set up a Kubernetes cluster on Ubuntu, including essential components like Docker and Calico network plugin. Remember to embrace these practices will empower you to deploy scalable, efficient container Orchestration environment ready to handle your application workloads with ease and reliability. This journey into Kubernetes not only enhances your infrastructure but also prepares you for the dynamic demands of modern Software development. Subscribe to the channel: https://bit.ly/3vY16CT Read my blog: https://angrysysops.com/ Twitter: https://twitter.com/AngrySysOps Facebook: https://www.facebook.com/AngrySysOps My Podcast: https://bit.ly/39fFnxm Mastodon: https://techhub.social/@AngryAdminCopyright © 2024 Angry Admin Design by ThemesDNA.com This website has updated its privacy policy in compliance with changes to European Union data protection law, for all members globally. We’ve also updated our Privacy Policy to give you more information about your rights and responsibilities regarding your privacy and personal Information. Please read this to review the updates about which cookies we use and what information we collect on our site. By continuing to use this site, you are agreeing to our updated privacy policy. OK

Leave a Reply