Kubernetes simplifying: Setting up local environment – creating Kubernetes cluster locally (helps in Interview Preparation) – Kubernetes for beginners

kubernetes components / kubernetes architecture
kubernetes components / kubernetes architecture

Hi All,

Greetings for the day 🙂 LIFE IS BEAUTIFUL 🙂

In last couple of articles we are discussing Docker and Kubernetes. We have created simple .NET CORE application and created docker image – Docker – Introduction to Containers and Docker – part 2 – Creating first Docker program – our first container with detailed steps 🙂

We have two kubernetes articles as well, please have a look once

Kubernetes – Introduction / starting point for beginners (Helps to prepare the interview)

Complete Guide To YAML

Today in this article we will discuss how to set up Kubernetes environment on our Linux box and in next article we will deploy our docker image / container to Kubernetes cluster

What is Kubernetes cluster:

  • Cluster / group of computers that are connected to work as single unit
  • Computers are either VM or physical machine

Kubernetes cluster resources : Here, I would say just read now even though difficult to understand and try to understand as it get understood. At initial stage this is bit complex to understand and components / concepts since those are so interlinked, we need to keep reading unless we didn’t understand all components

I am trying to keep as simple as possible and will move to bit in details as we move

Nodes :

 Kubernetes - Worker node - Virtual Machine / Physical server
Fig : Kubernetes – Worker node – Virtual Machine / Physical server
  • A Node is virtual machine or physical machine – either master machine or worker machine
    • A Node is machine (worker node) where our docker image / containerized application runs
    • Every cluster has at least minimum one node
    • There are two kind of nodes
      • Master node / Control plane
      • Worker node
        • Worker node contains multiple PODs
        • Each POD contains containers
    • Worker Node components: please check the below diagram
      • kubelet
        • An agent that runs on every node
        • Kubelet from worker node communicates with master node
        • It makes sure our containers are running in POD => Group of one or more containers (We will discuss POD in upcoming articles. Currently understand that PODS are the way to run the containers on nodes)
        • Also manages the requests from API server related to deploy or destroy container and again communicate with master node
      • container runtime
        • We need to run the container runtime on each node
        • Software which make sure containers are running
        • Example : Docker, containers
      • kube-proxy
        • Way to communication between worker nodes
    • Best practices for PROD environment:
      • A kubernetes cluster for application in production environment should have at least minimum 3 nodes
  • Control Plane / Master Node : please check the below diagram
    • The Control Plane is responsible for managing cluster
    • The Control Plane manages each node in cluster
    • The Control Plane also contain the services required to run the POD on the node
    • The Control Plane coordinates all activities in cluster
      • scheduling applications
      • maintaining applications desired state
      • scaling applications
      • rolling out new updates
    • Control Plane components :
      • kube-apiserver
        • Master node communicates with worker node using API server
        • Front-end for kubernetes control plane
        • Takes the input from user in the form of YAML / JSON format to the API server, then it processes and executes
      • etcd
        • Distributed key value store
        • Used to store the details of cluster state
        • Kubernetes stores the file in database called etcd
        • Also used to store the details of config maps and subnets
      • kube-scheduler
        • Used to schedule the work on different worker node
        • Scheduler manages the new requests from API server and passes to respective node
      • kube-controller-manager
kubernetes components / kubernetes architecture
Fig : kubernetes components / kubernetes architecture

To set up the Kubernetes cluster on local machine (either physical or VM ) we need two utilities

  • Minikube / There is other alternative as well using kubeadm utility. We will discuss kubeadm in upcoming articles
  • Kubectl

What is Minikube :

  • Minikube is light weight utility which creates a Virtual Machine (VM) on our local environment and creates Kubernetes cluster with single node
  • We use Minikube for learning and development purpose
  • Minikube is available for all major OS – LINUX, WINDOWS and MAC OS
  • Minikube CLI is available which provides basic commands to start, stop, delete and status of Minikube
  • Installing Minikube on our Linux box

curl -Lo minikube.exe https://github.com/kubernetes/minikube/releases/latest/download/minikube-windows-amd64.exe

Fig : Installing Minikube - downloading Minikube
Fig : Installing Minikube – downloading Minikube
  • If Minikube downloaded successfully, install it and start
Fig : Installing Minikube - installing Minikube and starting
Fig : Installing Minikube – installing Minikube and starting
  • Once we have Minikube successfully installed and started we are ready to manage Kubernetes cluster
  • To manage Kubernetes cluster / run commands against Kubernetes cluster – we need Kubectl command line utility

What is Kubectl :

  • Kubectl is command line tool allows us to execute command against Kubernetes cluster
  • Kubectl is available for all major OS including – Windows, Linux and MacOS
  • Installing Kubectl on Ubuntu
    • Download the Kubectl using CURL
    • Once downloaded successfully, install it

curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl

  • With these two utilities installations, we are ready with single node cluster and ready to deploy our docker image / container in Kubernetes cluster
  • But before going to deploy our first docker image / container to Kubernetes cluster we need to understand few concepts / kubernetes object in depth like – I’ll discuss all these concepts in upcoming articles
    • Pods
    • Replica Sets
    • Deployments
    • Services

Thanks 🙂

STAY SAFE 🙂 STAY HEALTHY 🙂

Prasham Sabadra

LIFE IS VERY BEAUTIFUL :) ENJOY THE WHOLE JOURNEY :) Founder of Knowledge Junction and live-beautiful-life.com, Author, Learner, Passionate Techie, avid reader. Certified Professional Workshop Facilitator / Public Speaker. Scrum Foundation Professional certificated. Motivational, Behavioral , Technical speaker. Speaks in various events including SharePoint Saturdays, Boot camps, Collages / Schools, local chapter. Can reach me for Microsoft 365, Azure, DevOps, SharePoint, Teams, Power Platform, JavaScript.

You may also like...

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: