Kubernetes For Beginners

Architecture & Components

acloudguy.in
5 min readFeb 11, 2022

Hello Readers, Welcome back !

Lets talk about Kubernetes & start from the scratch. #Beginners

Image Source: Google

Kubernetes:

It is a portable, extensible, open-source platform for managing containerized workloads and services. It has a large, rapidly growing ecosystem. Kubernetes services, support, and tools are widely available.

Container:

A container is a ready-to-run software package, containing everything needed to run an application: the code and any runtime it requires, application and system libraries, and default values for any essential settings.

Nodes:

A node is a machine either physical or virtual machine on which Kubernetes is installed. A node is a worker machine and this is where containers inside the pods will be launched by Kubernetes.

Pod:

A pod is the smallest deployable unit that can be managed by Kubernetes. A pod is a logical group of one or more containers that share the same IP address and port space. The main purpose of a pod is to support co-located processes, such as an application server and its local cache.

Image Source: Handmade

Master Node: (aka Control Plane)

  • The Master node (Brain) manages the worker nodes (Body) and the Pods in the cluster.
  • Its components are as depicted in the diagram ( ETCD, Kube-apiserver, Kube-scheduler etc )
  • The master makes global decisions about the cluster and they also detect and respond to cluster events like starting up a new pod when a deployment’s field “replicas” is unsatisfied. (replicas dictate the number of identical structures of nodes to be kept at any given point in time)
  • Master components, set up scripts typically start all master components on the same machine, and do not run user containers on this machine for the sake of simplicity.

Worker Node:

  • The worker nodes are the part of the Kubernetes clusters which actually execute the containers and applications on them.
  • These worker nodes have docker containers for each application running on them. There may be a different number of containers running on each node depending on the distribution of the workload.
  • Worker nodes are generally more powerful than master nodes because they have to run hundreds of clusters on them.
  • However, master nodes hold more significance because they manage the distribution of workload and the state of the cluster.
Image Source: Google

ETCD:

  • It is a distributed reliable key-value store(database) that is easy to install, secure, persistence, highly available & fast.
  • Its used to store & retrieve small bit of cluster data which requires fast read & write.
  • Its not a traditional/relational database rather a Key-value format database store.
  • It stores information regarding the cluster i.e., Nodes, PODs, Secrets, Configs, Roles, Accounts etc.
  • Installation — Download Binaries -> Extract -> Run ETCD Service.
  • Default port 2379 & Default client etcdctl.
  • ETCDCTL is the CLI tool used to interact with ETCD.

KUBE CONTROLLER:

  • It manages various controllers & it has its own set of responsibilities.
  • It is a process which continuously monitors the state of components & works towards bringing the cluster to desired state.
  • There are ample amount of controllers such as Deployment, Replica set, Endpoint, Job, Node, Namespace etc.
  • Logically, each controller is a separate process, but to reduce complexity, they are all compiled into a single binary and run in a single process.
  • It is similar to our “police department”, which continuously checks the status of the city & takes action to remediate the situation accordingly.

KUBE-APISERVER:

  • It is a primary management component in Kubernetes.
  • The API server is a component of the Kubernetes master node (Control Plane) that exposes the Kubernetes API.
  • It authenticates user, validates requests + retrieves & updates data from ETCD Cluster.
  • kubectl is used to communicate with kube-apiserver or we can invoke api directly by sending a POST method request.

KUBE-SCHEDULER:

  • It is only responsible for deciding which pod goes on which node.
  • Which get decided on certain criterion ( CPU, Memory etc )
  • Firstly scheduler tries to filter out the nodes that do not fit for pod.
  • Secondly it give priority to nodes having optimal resource usage.
  • REMEMBER “It does not actually place the pod on the nodes”

KUBELET:

  • An agent that runs on each node in the cluster & also makes sure that containers are running in a POD. #Informer
  • The kubelet in the worker node, registers the node with the kubernetes cluster.
  • The kubelet continues to monitor the state of the POD and the containers in it and reports to the kube-apiserver on a timely basis.
  • The kubelet doesn’t manage containers which were not created by Kubernetes.

KUBE-PROXY:

  • kube-proxy is a network proxy that runs on each node in your cluster.
  • Its job is to look for new services and every time a new service is created it creates the appropriate rules on each node to forward traffic to those services to the backend pods.
  • kube-proxy maintains network rules on nodes.
  • These network rules allow network communication to your PODs from network sessions inside or outside of your cluster.
  • One way it does this is using IPTABLES rules.

#community #opensource #aws #K8s #EKS #docker #computing

I am Kunal Shah, AWS Certified Solutions Architect, helping clients to achieve optimal solutions on the Cloud. Cloud Enabler by choice, DevOps Practitioner having 7+ Years of overall experience in the IT industry.

I love to talk about Cloud Technology, DevOps, Digital Transformation, Analytics, Infrastructure, Dev Tools, Operational efficiency, Serverless, Cost Optimization, Cloud Networking & Security.

You can reach out to me @ acloudguy.in

In the next article I’ll try to jump into the depth of kubernetes.

Until then, Keep learning :)

Also don't forget to hit the clap button if you like the article !!

--

--

acloudguy.in

AWS Community Builder | AWS Solutions Architect | Infrastructure | DevOps | Cloud Network & Security | CFT | Terraform | K8s | SysOps | FinOps | Blog | Share