Kubernetes :2

DevOps Classroom Series – 06/Apr/2021

Installing Kubernetes

  • K8s can be installed on a single node to set up the developer environments.
    • minikube
  • On production environments we would be using a multi node setup
    • For IOT / ARM processers => K3s (Lightweight kuberenetes)
    • Kubeadmin (multi node setup on linux workloads)
    • Kops Refer Here for installing k8s on AWS
    • kubespray Refer Here
    • Native Kubernetes on Cloud
      • AKS (Azure Kubernetes Services)
      • GKE (Google Kubernetes Engine)
      • EKS (Elastic Kubernetes Services on AWS)
  • Lets try to setup
    • minikube
    • kubeadm

Minikube

  • This is a tool to set up a single node cluster and suitable for local environments.
  • To setup minikube Refer Here
  • Commands
choco install minikube -y
minikube start

Preview
Preview
Preview
  • Check the nodes Preview
  • Check all the pods Preview

Kubeadm

  • In this article we will be creating a kubernetes cluster on multiple linux nodes using kubeadm Refer Here
  • We would be creating a 3 node kubernetes cluster Preview
  • Lets follow the installation guide Refer Here
  • Install container runtime on the nodes. Lets use docker container Refer Here
  • Now install kubeadm, kubectl and kubelet by following instructions Refer Here Preview
  • Now lets install pod network
kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')"

Preview
  • Now lets login into the node become a root user and execute the kubeadm join command
kubeadm join 10.128.0.49:6443 --token <somtoken>

Preview
  • Now login into k8s master and execute kubectl get nodes Preview Preview
  • Summary of installation
    • Install docker on the nodes (both) and execute the steps mentioned in Refer Here Preview
    • Install the kubeadm, kubelet and kubectl on both nodes Refer Here Preview
    • Now initialize the kubeadm by loggin in as root user on master node
    kubeadm init
    • Copy the commands to configure the kubectl and join command Preview
    • Now become the non root user and execute the following Preview
    • Now install a pod network on master node and verify if the node is in ready state by executing kubectl get nodes
    kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')"
    • Now login into node and become root user (sudo -i) and execute the join command Preview
    • Now login into master node and execute kubectl get nodes to see the status of both nodes