Kubernetes

What is Kubernetes?

Kubernetes is a open-sourced platform used to deploy containerized application. If a container crashed, kubernetes can restart or replace it automatically. It is automates deployment, monitoring and scaling.

What are the features of Kubernetes?

These are the features of Kubernetes:

  • Self-healing
  • Resource optimization
  • Scaling and load balancing
  • Rollouts and Rollbacks
  • Automated scheduling
  • Containerized infrastructure

What is Kubernetes pod?

Kubernetes pod is the smallest object. Kubernetes do not run container directly, it run pod.

What is Ingress?

It is used to manage external service within a cluster. Traffic routing rules are defined in Ingress resources.

What is a Cluster?

A Cluster is a collection of nodes which works in a single unit. All of these nodes work together to manage containerized application in a single unit.

How to setup Kubernetes Cluster in Ubuntu?

Step 1:

Setup host name at node

$ sudo hostnamectl set-hostname master-node

Step 2:

update and defined host-to-IP mapping

$ sudo nano /etc/hosts
192.168.43.95 master-node

Step 3:

disable swap and load kernel modules

$ sudo swapoff -a
$ sudo swapoff -$ sudo sed -i ‘/ swap / s/^\(.*\)$/#\1/g’ /etc/fstab
$ sudo modprobe overlay
$ sudo modprobe br_netfilter

create configuration file and IP forwarding

$ echo -e “overlay\nbr_netfilter” | sudo tee /etc/modules-load.d/k8s.conf
$ echo -e “net.bridge.bridge-nf-call-ip6tables = 1\nnet.bridge.bridge-nf-call-iptables = 1\nnet.ipv4.ip_forward = 1” | sudo tee /etc/sysctl.d/kubernetes.conf
$ sudo sysctl –system

Step 4:

install and configure containered

install depndency

$ sudo apt update
$ sudo apt install -y curl gnupg2 software-properties-common apt-transport-https ca-certificates

Add GPG key and repository

$ sudo mkdir -p /etc/apt/keyrings $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo tee /etc/apt/keyrings/docker.asc > /dev/null $ echo “deb [signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable” | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
$ sud$ sudo apt update && sudo apt install -y containerd.io
$ sudo mkdir -p /etc/containerd $ containerd config default | sudo tee /etc/containerd/config.toml >/dev/null 2>&1 $ sudo sed -i ‘s/SystemdCgroup = false/SystemdCgroup = true/g’ /etc/containerd/config.toml $ sudo systemctl restart containerd
$ sudo curl -fsSLo /etc/apt/keyrings/kubernetes-apt-keyring.asc https://pkgs.k8s.io/core:/stable:/v1.30/deb/Release.key $ echo “deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.asc] https://pkgs.k8s.io/core:/stable:/v1.30/deb/ /” | sudo tee /etc/apt/sources.list.d/kubernetes.list

Step 5:

install Kubernetes components and initialized kubernetes cluster

$ sudo apt update
$ sudo apt install -y kubelet kubeadm kubectl

Leave a comment