Install Ubuntu on Kubernetes

May 31, 2024

How to Install Ubuntu on Kubernetes

Introduction

  • Kubernetes: Open-source platform for deployment and management of containers.

Step-by-Step Installation Guide

Step 1: Install Necessary Dependencies

  1. Update system packages:
    sudo apt-get update
    
    • Enter password if prompted.
  2. Install app-transport-https:
    • For making repositories accessible via HTTPS.
    sudo apt-get install app-transport-https
    

Step 2: Install Docker

  1. Install Docker:
    sudo apt install docker.io
    
    • Choose 'y' when prompted.
  2. Start and enable Docker:
    sudo systemctl start docker
    sudo systemctl enable docker
    

Step 3: Install Kubernetes Components

  1. Install curl command:
    • For sending data using a URL syntax.
    sudo apt-get install curl
    
  2. Download and add key for Kubernetes installation:
    • Download the key:
    sudo curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
    
  3. Add Kubernetes repository:
    • Change permission of file:
    sudo chmod 644 /etc/apt/sources.list.d/kubernetes.list
    
    • Add repository info to the file:
    sudo bash -c 'cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
    deb https://apt.kubernetes.io/ kubernetes-xenial main
    EOF'
    
  4. Check for available updates:
    sudo apt-get update
    
  5. Install Kubernetes components:
    • Install kubelet, kubeadm, kubectl, kubernetes-cni:
    sudo apt-get install -y kubelet kubeadm kubectl kubernetes-cni
    

Step 4: Initialize the Master Node

  1. Disable swap:
    sudo swapoff -a
    
  2. Initialize Kubernetes:
    sudo kubeadm init
    
  3. Set up Cluster Configuration:
    • Run the following commands:
    mkdir -p $HOME/.kube
    sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
    sudo chown $(id -u):$(id -g) $HOME/.kube/config
    
  4. Deploy Pods:
    kubectl apply -f https://docs.projectcalico.org/v3.14/manifests/calico.yaml
    
  5. Check pods status:
    kubectl get pods -A
    

Conclusion

  • Successfully installed and configured Ubuntu on Kubernetes.
  • Check SimplyLearn YouTube for more tutorials.
  • Don't forget to subscribe and get certified.