Services DevOps DevSecOps Cloud Consulting Infrastructure Automation Managed Services AIOps MLOps DataOps Microservices 🔐 Private AINEW Solutions DevOps Transformation CI/CD Automation Platform Engineering Security Automation Zero Trust Security Compliance Automation Cloud Migration Kubernetes Migration Cloud Cost Optimisation AI-Powered Operations Data Platform Modernisation SRE & Observability Legacy Modernisation Managed IT Services 🔐 Private AI DeploymentNEW Products ✨ ZippyOPS AINEW 🛡️ ArmorPlane 🔒 DevSecOpsAsService 🖥️ LabAsService 🤝 Collab 🧪 SandboxAsService 🎬 DemoAsService Bootcamp 🔄 DevOps Bootcamp ☁️ Cloud Engineering 🔒 DevSecOps 🛡️ Cloud Security ⚙️ Infrastructure Automation 📡 SRE & Observability 🤖 AIOps & MLOps 🧠 AI Engineering 🎓 ZOLS — Free Learning Company About Us Projects Careers Get in Touch

How to Install Kubernetes on CentOS and Ubuntu

How to Install Kubernetes on CentOS and Ubuntu: A Step-by-Step Guide

Kubernetes is a powerful container orchestration tool that automates application deployment, scaling, and management. In this guide, we’ll walk you through the process of install Kubernetes on both CentOS and Ubuntu nodes. By the end, you’ll have a fully functional two-node Kubernetes cluster consisting of a master and a worker node.

Install Kubernetes master and worker node setup on CentOS and Ubuntu

Pre-requisites for Kubernetes Installation

Before we begin, make sure you meet the following requirements:

  • Puppet Enterprise (PE) is installed, as we will be using Puppet to automate the configuration.
  • Proper IP addressing for both Kubernetes master and worker nodes.

Node Configuration

In this setup, we will configure two sets of nodes: one with CentOS and the other with Ubuntu.

CentOS Node Configuration

  • Kubernetes Master Node:
    • Hostname: kubernetesmaster.zippyops.com
    • IP: 192.168.1.180
  • Kubernetes Worker Node:
    • Hostname: kubernetesworker.zippyops.com
    • IP: 192.168.1.181

Ubuntu Node Configuration

  • Kubernetes Master Node:
    • Hostname: ubuntukubernetesmaster.zippyops.com
    • IP: 192.168.1.182
  • Kubernetes Worker Node:
    • Hostname: ubuntukubernetesworker.zippyops.com
    • IP: 192.168.1.183

These configurations will ensure that your Kubernetes nodes are set up correctly and ready for deployment.

Setting Up Puppet Modules

To manage your Kubernetes nodes efficiently, we will use Puppet modules for the master and worker nodes. If you’re new to Puppet, it’s a configuration management tool that automates the deployment of software and system configurations.

Creating the Puppet Modules

Begin by creating the necessary modules on your Puppet master node.

  1. Create the Kubernetes Master Module: pdk new module kubemaster
  2. Create the Kubernetes Worker Module: pdk new module kubeworker

Once you’ve created the modules, you’ll need to clone the relevant Kubernetes module from GitHub. This will allow Puppet to manage the configuration of both master and worker nodes.

Clone the Kubernetes Module

On your Puppet master, execute the following command to clone the Kubernetes module:

git clone git@github.com:tamilsaran/kubernetes-module.git

Configuration of the IP Addresses

In order to update the IP addresses for the Kubernetes nodes, navigate to the following path:

/etc/puppetlabs/code/environments/production/modules/kubeworker/manifests/worker.pp

Modify the IP addresses accordingly. For CentOS, you’ll set the master node’s IP, and similarly, for the Ubuntu nodes, configure the appropriate IP.

With the modules and IP configurations in place, you’re ready to deploy Kubernetes on both your CentOS and Ubuntu nodes.

Deploying Kubernetes on CentOS and Ubuntu

After setting up Puppet, you’ll need to deploy Kubernetes on both the master and worker nodes. Kubernetes provides various methods for installation, but the easiest way is to use the official Kubernetes package repository.

Install Kubernetes on CentOS

  1. Install Docker:
    Kubernetes requires Docker for container management. Begin by installing Docker on both the master and worker nodes.
  2. Set Up Kubernetes Repository:
    Use the following commands to add the Kubernetes repository to your CentOS system: sudo cat <<EOF > /etc/yum.repos.d/kubernetes.repo

[kubernetes]

name=Kubernetes baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64 enabled=1 gpgcheck=1 gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg EOF

Install Kubernetes Components:
Now, install the Kubernetes packages:

sudo yum install -y kubelet kubeadm kubectl

Start Kubernetes:
Start the Kubernetes service and enable it to start on boot:

sudo systemctl enable --now kubelet

Install Kubernetes on Ubuntu

For Ubuntu, the installation process is similar, with some variations in package management:

  1. Install Docker:
    First, install Docker on both nodes: sudo apt update sudo apt install -y docker.io
  2. Set Up Kubernetes Repository:
    Add the Kubernetes repository to your Ubuntu system: sudo apt update && sudo apt install -y apt-transport-https curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - sudo apt update
  3. Install Kubernetes Packages:
    Install Kubernetes components on your master and worker nodes: sudo apt install -y kubelet kubeadm kubectl
  4. Start Kubernetes:
    Enable and start the Kubernetes service: sudo systemctl enable --now kubelet

Managing Kubernetes with Puppet

At this stage, both your CentOS and Ubuntu nodes should have Kubernetes installed. With Puppet, you can manage your infrastructure more efficiently. ZippyOPS offers consulting, implementation, and managed services to help streamline your Kubernetes management through DevOps, DevSecOps, DataOps, and Cloud solutions.

Whether you’re managing a microservices architecture or automating your operations with AIOps, ZippyOPS provides the expertise to help. We offer tailored services for infrastructure management, security, and MLOps, ensuring your Kubernetes environment is secure and optimized.

If you’re looking for professional Kubernetes management, don’t hesitate to reach out to ZippyOPS at sales@zippyops.com. For more details, explore our services at ZippyOPS Services or watch our tutorials on YouTube.

Conclusion on Install Kubernetes on CentOS and Ubuntu

In this guide, we’ve walked through the installation of Kubernetes on CentOS and Ubuntu nodes, setting up Puppet modules, and deploying Kubernetes using the official Kubernetes package repository. By following these steps, you can easily manage and scale your containerized applications.

If you’re ready to take your Kubernetes deployment to the next level, ZippyOPS offers expert consulting and managed services to optimize your infrastructure. Reach out to us today to enhance your Kubernetes experience.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top