<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Bharat Gera on Medium]]></title>
        <description><![CDATA[Stories by Bharat Gera on Medium]]></description>
        <link>https://medium.com/@bharatgera?source=rss-152227713188------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*jMgEj9TUTLDlMsJ5.jpg</url>
            <title>Stories by Bharat Gera on Medium</title>
            <link>https://medium.com/@bharatgera?source=rss-152227713188------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 08:51:21 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@bharatgera/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Introducing Kubernetes]]></title>
            <link>https://medium.com/@bharatgera/introducing-kubernetes-9e2b4874f713?source=rss-152227713188------2</link>
            <guid isPermaLink="false">https://medium.com/p/9e2b4874f713</guid>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[container-orchestration]]></category>
            <category><![CDATA[cluster]]></category>
            <category><![CDATA[application-deployment]]></category>
            <category><![CDATA[tech]]></category>
            <dc:creator><![CDATA[Bharat Gera]]></dc:creator>
            <pubDate>Fri, 28 Aug 2020 13:47:22 GMT</pubDate>
            <atom:updated>2020-08-28T13:47:22.092Z</atom:updated>
            <content:encoded><![CDATA[<p>Today, the big monolithic legacy applications are slowly being broken down into smaller, independently running components called microservices. Because microservices are decoupled from each other, they can be developed, deployed, updated, and scaled individually.</p><p>But with bigger numbers of deployable components and large number of services, it becomes increasingly difficult to configure, manage, and keep the whole system running smoothly. It’s much harder to figure out where to put each of those components to achieve high resource utilisation and thereby keep the hardware costs down. Doing all this manually is hard work.</p><p>We need automation, which includes automatic scheduling of those components to our servers, automatic configuration, supervision, and failure-handling. This is where <strong>Kubernetes</strong> comes in.</p><p><strong>Need of Kubernetes:</strong></p><ol><li><strong>Splitting apps into microservices</strong>: Each microservice runs as an independent process and communicates with each other through synchronous protocols such as HTTP or through asynchronous protocols such as AMQP. Now we can easily scale out the individual components depending on the resources required.</li></ol><p>As shown in the figure 1, certain components are replicated, deployed and scaled as an individual component.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/491/1*4rF8a4R6JzRUsYuPjDRVkg.png" /><figcaption><strong>Figure 1</strong></figcaption></figure><p>When the number of these components/services increases, deployment-related decisions become increasingly difficult because not only does the number of deployment combinations increase, but the number of inter-dependencies between the components increases by an even greater factor.</p><p>Microservices also bring other problems, such as making it hard to debug and trace execution calls, because they span multiple processes and machines.</p><p>When different components depend on different library versions, it would become nightmare to deploy and manage the components on same host.</p><p>2. <strong>Consistent environment to applications</strong>: This is one of the biggest problems that developers and operations teams always have to deal with is the difference in their environments and libraries version they run their apps in. While working on different components, different teams have different local machine environment as compare to production machines. We require system, which helps us to run the application in the same environment during development and in production. And also, we want the ability to run multiple applications on same host server with different version dependencies.</p><p>3. <strong>Continuous delivery</strong>: it’s better to have the same team that develops the application also take part in deploying it and taking care of it over its whole lifetime. But deploying an application often requires an understanding of the underlying infrastructure and the hardware in the datacenter. Developers don’t always know those details and, most of the time, don’t even want to know about them. Ideally, we want some abstraction layer or some kind of system which helps to deploy the application without knowing the peculiarities of hardware. Obviously, we need someone to take care of.</p><p>This is where kubernetes comes in. By abstracting the actual hardware and exposing it as a single platform for deploying and running apps.</p><p><strong>So, how we define kubernetes at very high level</strong>:</p><p>Kubernetes is a software system that allows us to easily deploy and manage containerised applications. It relies on the Linux containers to run heterogeneous applications without having to know any internal details of these applications.</p><p>Kubernetes enables us to run our software applications on thousands of computer nodes as if all those nodes were a single, enormous computer.</p><p><strong>Let’s dive into architecture of Kubernetes</strong>:</p><p>We have seen a bird’s eye of kubernetes and its need in scaling and streamlining the application deployments. Let’s take a closer look at what a Kubernetes cluster is composed of.</p><p>Kubernetes cluster is composed of many nodes which we split into two types:</p><ol><li>The <strong>master node</strong>, which hosts the Kubernetes Control Plane that controls and manages the whole Kubernetes system.</li><li><strong>Worker nodes</strong> that run the actual applications you deploy.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/706/1*raYS1-npd0nEyW8NImW2SA.png" /><figcaption><strong>Figure 2</strong></figcaption></figure><p><strong>Components of Control Plane:</strong></p><p>The control plane is what controls and makes the whole cluster functional. This plane consists of multiple components which can be run on single master node or can be replicated on multiple nodes to make it highly available.</p><ol><li><strong>API Server</strong>: The Kubernetes API server is the central component used by all other components and by clients, such as kubectl. It provides a CRUD (Create, Read, Update, Delete) interface for querying and modifying the cluster state over a RESTful API. It stores that state in etcd (database used in cluster). In addition to provide the consistent view, API server also performed the authentication and authorization of clients by using various plugins available.</li><li><strong>Scheduler</strong>: It schedules your apps on the worker node which fulfil all conditions of running it. The selection of a node can be broken down into two parts:</li></ol><p>a) Filtering the list of all nodes to obtain a list of acceptable nodes the pod can be scheduled to.</p><p>b) Prioritising the acceptable nodes and choosing the best one. If multiple nodes have the highest score, round-robin is used to ensure pods are deployed across all of them evenly.</p><p>3. <strong>Controller Manager</strong>: It performs cluster-level functions, such as replicating components, keeping track of worker nodes, handling node failures, and so on. The list of various controllers includes ReplicaSet, Deployment, StatefulSet, Endpoints, DaemonSet, Job controller and many more. Depending on the application and system requirement we define the controller.</p><p>4. <strong>etcd</strong>: A reliable distributed data store that persistently stores the cluster configuration.</p><p><strong>Worker Nodes</strong>:</p><p>The worker nodes are the machines that run your containerized applications. The task of running, monitoring, and providing services to your applications is done by the following components:</p><p>1. Docker, rkt, or another container runtime, which runs your containers</p><p>2. The Kubelet, which talks to the API server and manages containers on its node</p><p>3. The Kubernetes Service Proxy<em> (</em>kube-proxy<em>)</em>, which load-balances network traffic between application components</p><p>In figure 2, API server is coordinating with every other component present in the cluster. Other components don’t know the existence of each other such as scheduler doesn’t know whether controller exists or not in system. API server is the only point where every other component work in sync. Even on worker node, Kubelet would watch for changes on API server by opening a HTTP connection. This is how kubernetes achieve the decoupling in cluster between the components.</p><p>For cluster high availability, the components can be scaled by running the multiple worker nodes. In case of master node, we can deploy the etcd database on multiple instances, API server behind the load balancer and Scheduler, Controller can be deployed using leader elect option.</p><p><strong>Running an Application in Kubernetes</strong>:</p><p>As shown in figure 3, to run an application in kubernetes, you need to package it up in one or more containers depending on application and then post those images on the image registry.</p><p>After posting images, provide the description config to kubernetes API server in control plane. The description config includes container image or images that contain your application components, how those components are related to each other. For each component, you can also specify how many copies (or replicas) you want to run.</p><p>The description also includes which of those components provide a service to either internal or external clients and should be exposed through a single IP address and made discoverable to the other components.</p><p>The description part is nothing but can be yaml or json config files.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/881/1*MIh0iwfMUKxU-WcbHt-KPQ.png" /><figcaption><strong>Figure 3</strong></figcaption></figure><p>In above figure, We provide description config to the API server, every other component/client would watch the API server by opening an HTTP connection to observe the changes deployed. The controller would check the pod related configuration such as number of replicas, the scheduler will find the appropriate worker node on which these containers can be run. The kubelet which is running on worker node, would get the notification from API server for running the containers. The kubelet on those worker nodes instruct the container runtime (Docker etc.) to pull the required images and run the containers.</p><p><strong>The chain of Events</strong>:</p><p>Imagine you prepared the YAML file containing the Deployment manifest and you’re about to submit it to Kubernetes through kubectl. kubectl sends the manifest to the Kubernetes API server in an HTTP POST request. The API server validates the Deployment specification, stores it in etcd, and returns a response to kubectl. Now a chain of events starts to unfold as shown in figure 4.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/761/1*IQkXJrf14-lzy1Uyo74pGA.png" /><figcaption><strong>Figure 4</strong></figcaption></figure><p>When we submit a resource manifest (above is deployment resource), it would first send to API server and all other components/clients are watching using the API server’s watch mechanism. When the config file is deployed on API server, the deployment resource would be created and the responsible controller which is deployment controller in this case would get activated and gets the notification.</p><p>The deployment controller then instructs the server to create the ReplicaSet resource. When this happened, the particular ReplicaSet controller would get notification and it would instruct the API server to create pods (replicas depend on manifest). The Scheduler would watch the event and by applying the scheduler algorithm, it would give instructions to API server to schedule the pods on particular worker node.</p><p>As API Server would get the update from scheduler, the event is noticed by Kubelet by using same watch mechanism. Then kubelet would instruct the container runtime in this case it is docker, to run the containers. This way different containers of application would run on worker nodes which are manages by control plane in cluster.</p><p>This is the basics of kubernetes cluster and how different components work together. In the subsequent part, I would be discussing various resources, controllers in kubernetes and how do we deploy the application on kubernetes cluster and correspondingly scale it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9e2b4874f713" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>