Overview of Kubernetes Components
Tags: computerscience, kubernetes, programming, devops
Published: 2021-01-09 04:50:30

*In case it helped :)*
<a href="https://www.buymeacoffee.com/aseemwangoo" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png" alt="Pass Me A Coffee!!" style="height: 41px !important;width: 174px !important;box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;" ></a>

<!-- wp:heading {"level":4} -->
<h4>What is Kubernetes?</h4>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>As per the <a href="https://kubernetes.io/docs/concepts/overview/what-is-kubernetes/" rel="noreferrer noopener" target="_blank">official website</a></p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center"} -->
<div class="wp-block-image"><figure class="aligncenter"><img src="https://cdn-images-1.medium.com/max/1600/0*msaf-1NkbrpLh5eW.png" alt="Overview of Kubernetes Components"/><figcaption>Overview of Kubernetes Components</figcaption></figure></div>
<!-- /wp:image -->

<!-- wp:quote -->
<blockquote class="wp-block-quote"><p>Kubernetes is an open-source platform for managing containerized workloads and services. Some of its capabilities include:</p></blockquote>
<!-- /wp:quote -->

<!-- wp:list -->
<ul><li><strong>Service discovery and load balancing: </strong>It can expose a container using the DNS name or using their own IP address and if the traffic to a container is high, Kubernetes is able to load balance and distribute the network traffic.</li><li><strong>Storage orchestration: </strong>It allows you to automatically mount a storage system of your choice, such as local storage, public cloud providers, and more.</li><li><strong>Automated rollouts and rollbacks: </strong>Automate Kubernetes to create new containers for your deployment, remove existing containers and adopt all their resources to the new container</li><li><strong>Self-healing: </strong>Restarts containers that fail, replaces containers, kills containers that don’t respond to your user-defined health check</li><li><strong>Secret and configuration management: </strong>Lets you store and manage sensitive information, such as passwords, OAuth tokens, and SSH keys</li></ul>
<!-- /wp:list -->

<!-- wp:separator -->
<hr class="wp-block-separator"/>
<!-- /wp:separator -->

####Article here: https://flatteredwithflutter.com/kubernetes-components/

<!-- wp:heading {"level":4} -->
<h4>Why is it&nbsp;popular?</h4>
<!-- /wp:heading -->

<!-- wp:image {"align":"center"} -->
<div class="wp-block-image"><figure class="aligncenter"><img src="https://cdn-images-1.medium.com/max/1600/1*LwAK_zj0ZVAfcRWtV7MPjw.png" alt="Overview of Kubernetes Components"/><figcaption>Overview of Kubernetes Components</figcaption></figure></div>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p><strong>Traditional Deployment</strong>: In the early days, organizations ran applications on physical servers. There was no way to define resource boundaries for applications in a physical server, and this caused resource allocation issues</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><strong>Container Deployment</strong>: Containers are considered lightweight. Similar to a VM, a container has its own filesystem, the share of CPU, memory, process space, and more. As they are decoupled from the underlying infrastructure, they are portable across clouds and OS distributions.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Other factors:</p>
<!-- /wp:paragraph -->

<!-- wp:list -->
<ul><li>In the previous time, as the trend for microservices grew, companies began deploying more and more of them.</li><li>There was no proper way to manage them.&nbsp;</li></ul>
<!-- /wp:list -->

<!-- wp:separator -->
<hr class="wp-block-separator"/>
<!-- /wp:separator -->

<!-- wp:heading {"level":4} -->
<h4>Rise of&nbsp;DevOps</h4>
<!-- /wp:heading -->

<!-- wp:image {"align":"center"} -->
<div class="wp-block-image"><figure class="aligncenter"><img src="https://cdn-images-1.medium.com/max/1600/0*auRQN94_cVM-f86o.jpg" alt="DevOps"/><figcaption>DevOps</figcaption></figure></div>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>Kubernetes introduced DevOps. Without Kubernetes, software development teams need to script down their own software deployment, scale it manually, and update workflows. In a large enterprise, DevOps handles this task.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":4} -->
<h4>Kubernetes Components</h4>
<!-- /wp:heading -->

<!-- wp:image -->
<figure class="wp-block-image"><img src="https://cdn-images-1.medium.com/max/1600/1*HL61SeOXx9yX1URfwz86-g.png" alt=""/><figcaption>Overview of Kubernetes</figcaption></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p><strong>Pod:</strong></p>
<!-- /wp:paragraph -->

<!-- wp:list -->
<ul><li>The smallest unit of Kubernetes (K8s)</li><li>It is an abstraction over the container</li><li>Any containers in the same pod will share the same resources and local network.</li><li>Containers can easily communicate with other containers in the same pod.</li><li>Each pod gets its own IP address, and when a pod dies, a new IP is assigned.</li><li>Pods are the unit of replication in K8s. If the application becomes popular and a single pod instance can’t carry the load, Kubernetes can be configured to deploy new replicas of your pod to the cluster.</li></ul>
<!-- /wp:list -->

<!-- wp:image -->
<figure class="wp-block-image"><img src="https://cdn-images-1.medium.com/max/1600/1*T6rU2t3cdUD0oBCp8QADQg.png" alt=""/><figcaption>Overview of Kubernetes Components |&nbsp;Pods</figcaption></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p><strong>Service:</strong></p>
<!-- /wp:paragraph -->

<!-- wp:list -->
<ul><li>Kubernetes gives Pods their own IP addresses and a single DNS name for a set of Pods and can load-balance across them.</li><li>The client sends a request to the stable IP address, and the request is routed to one of the Pods in the Service.</li><li>The lifecycle of a pod and service are not connected. So, if a pod dies, its service is not affected.</li><li>This component itself is a load balancer.</li><li>A Service identifies its member Pods with a selector. For a Pod to be a member of the Service, the Pod must have all of the labels specified in the selector.</li></ul>
<!-- /wp:list -->

<!-- wp:image {"align":"center"} -->
<div class="wp-block-image"><figure class="aligncenter"><img src="https://cdn-images-1.medium.com/max/1600/1*CSRvQVvS4RFb_I3RjOLZZg.png" alt="Overview of Kubernetes Components| Service"/><figcaption>Overview of Kubernetes Components| Service</figcaption></figure></div>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p><strong>Volume:</strong></p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>On-disk files in a container are ephemeral (<em>lasting for short time</em>), which presents some problems for non-trivial applications when running in containers.&nbsp;</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Problems:</p>
<!-- /wp:paragraph -->

<!-- wp:list {"ordered":true} -->
<ol><li>Loss of files when a container crashes. The kubelet restarts the container but with a clean slate.&nbsp;</li><li>Sharing files between containers running together in a <code>Pod</code>.&nbsp;</li></ol>
<!-- /wp:list -->

<!-- wp:quote -->
<blockquote class="wp-block-quote"><p>Enter Volume</p></blockquote>
<!-- /wp:quote -->

<!-- wp:list -->
<ul><li>Used for persisting data. Kubernetes guarantees data is preserved across container restarts.</li><li>It is a directory with some data, accessible to the containers in a pod.</li><li>There are different <a href="https://kubernetes.io/docs/concepts/storage/volumes/#awselasticblockstore" rel="noreferrer noopener" target="_blank">types of volumes</a> available</li><li>Apod can use any number of volume types simultaneously. Ephemeral volume types have a lifetime of a pod, but persistent volumes exist beyond the lifetime of a pod.</li></ul>
<!-- /wp:list -->

<!-- wp:paragraph -->
<p><strong>ConfigMap:</strong></p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center"} -->
<div class="wp-block-image"><figure class="aligncenter"><img src="https://cdn-images-1.medium.com/max/1600/0*dV9OJCW6l6psTQOo.jpg" alt="Overview of Kubernetes Components | ConfigMap"/><figcaption>Overview of Kubernetes Components | ConfigMap</figcaption></figure></div>
<!-- /wp:image -->

<!-- wp:list -->
<ul><li>ConfigMaps enable you to separate your configurations from your Pods and components.&nbsp;</li><li>This makes pod configurations easier to change and manage and prevents hardcoding configuration data to Pod specifications.</li><li>Let’s you set the configuration data separately from the application code.</li><li>Store non-confidential data in key-value pairs.</li><li>The pods read the data from this config map.</li></ul>
<!-- /wp:list -->

<!-- wp:quote -->
<blockquote class="wp-block-quote"><p>Note: To use sensitive information in your clusters, you must use Secrets.</p></blockquote>
<!-- /wp:quote -->

<!-- wp:paragraph -->
<p><strong>Secrets:</strong></p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center"} -->
<div class="wp-block-image"><figure class="aligncenter"><img src="https://cdn-images-1.medium.com/max/1600/1*Groh9Id_bM-ZUTylanmA-A.png" alt="Overview of Kubernetes Components | Secrets"/><figcaption>Overview of Kubernetes Components |&nbsp;Secrets</figcaption></figure></div>
<!-- /wp:image -->

<!-- wp:list -->
<ul><li><strong>Secrets</strong> are secure objects which store sensitive data, such as passwords, OAuth tokens, and SSH keys, in your clusters.</li><li>Using Secrets reduces the risk of exposing the data to unauthorized users.</li><li>Values stored are base64 encoded.</li></ul>
<!-- /wp:list -->

<!-- wp:quote -->
<blockquote class="wp-block-quote"><p>Note: Built-in security mechanism is not enabled by default in K8s</p></blockquote>
<!-- /wp:quote -->

<!-- wp:paragraph -->
<p><strong>Deployment:</strong></p>
<!-- /wp:paragraph -->

<!-- wp:list -->
<ul><li>Although pods are the basic unit of computation in k8s, they are managed by a layer of abstraction: <a href="https://kubernetes.io/docs/concepts/workloads/controllers/deployment/" rel="noreferrer noopener" target="_blank">deployment</a>.</li><li>A component that specifies the blueprint for a pod.&nbsp;</li><li>Used to create stateless applications.</li><li>Mostly you will not be working with pods, instead of with deployment.&nbsp;</li><li>Deployment’s primary purpose is to declare how many replicas of a pod should be running at a time.</li><li>If a pod dies, the deployment will automatically re-create it.</li></ul>
<!-- /wp:list -->

<!-- wp:paragraph -->
<p><strong>Ingress</strong>:</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>You can create a cluster of nodes, and launch deployments of pods onto the cluster. However, we need to allow external traffic to your application.</p>
<!-- /wp:paragraph -->

<!-- wp:quote -->
<blockquote class="wp-block-quote"><p>Enter Ingress</p></blockquote>
<!-- /wp:quote -->

<!-- wp:image -->
<figure class="wp-block-image"><img src="https://cdn-images-1.medium.com/max/1600/1*yElpQ0xjR_56gT4mTa-0NQ.png" alt="Overview of Kubernetes Components| Ingress"/><figcaption>Overview of Kubernetes Components| Ingress</figcaption></figure>
<!-- /wp:image -->

<!-- wp:list -->
<ul><li>Exposes HTTP and HTTPS routes from outside the cluster to services within the cluster.</li><li>Request from the outside world first goes to the ingress.</li><li>Ingress has the traffic routing rules defined and forwards the request to the appropriate service.</li></ul>
<!-- /wp:list -->

<!-- wp:paragraph -->
<p>There are multiple ways to add ingress to your cluster. The most common ways are by adding either an <a href="https://kubernetes.io/docs/concepts/services-networking/ingress/" rel="noreferrer noopener" target="_blank">Ingress</a> controller or a <a href="https://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/" rel="noreferrer noopener" target="_blank">LoadBalancer</a>.</p>
<!-- /wp:paragraph -->

<!-- wp:quote -->
<blockquote class="wp-block-quote"><p>Note: Client can be a web browser, mobile devices, etc.</p></blockquote>
<!-- /wp:quote -->

<!-- wp:paragraph -->
<p><strong>Stateful Set:</strong></p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>If you deploy any stateful application on Kubernetes, you’ll need to ensure that pods can reach each other through a unique identity that does not change (hostnames, IPs…etc.).&nbsp;</p>
<!-- /wp:paragraph -->

<!-- wp:quote -->
<blockquote class="wp-block-quote"><p>Enter Stateful Set</p></blockquote>
<!-- /wp:quote -->

<!-- wp:list -->
<ul><li>This is responsible for creating stateful applications, for instance, MySQL clusters, Redis, Kafka, MongoDB, and others.</li><li>Maintains a sticky identity for each of its pods. Each pod has a persistent identifier.</li></ul>
<!-- /wp:list -->

<!-- wp:image {"align":"center","width":580,"height":615} -->
<div class="wp-block-image"><figure class="aligncenter is-resized"><img src="https://cdn-images-1.medium.com/max/1600/0*VgwVAOd4uxTAUYZP" alt="Overview of Kubernetes Components | Stateful Set" width="580" height="615"/><figcaption>Overview of Kubernetes Components | Stateful&nbsp;Set</figcaption></figure></div>
<!-- /wp:image -->

<!-- wp:list -->
<ul><li>Headless Service like Nginx controls the network domain.</li></ul>
<!-- /wp:list -->

<!-- wp:paragraph -->
<p><strong>PersistentVolume:</strong></p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Programs running on your cluster aren’t guaranteed to run on a specific node. If a program tries to save data to a file for later but is then relocated onto a new node, the file will no longer be where the program expects it to be.&nbsp;</p>
<!-- /wp:paragraph -->

<!-- wp:quote -->
<blockquote class="wp-block-quote"><p>Enter PersistentVolume</p></blockquote>
<!-- /wp:quote -->

<!-- wp:image -->
<figure class="wp-block-image"><img src="https://cdn-images-1.medium.com/max/1600/0*9vFVWDZCr6SXSIhn.png" alt=""/><figcaption>Overview of Kubernetes Components | PersistentVolume</figcaption></figure>
<!-- /wp:image -->

<!-- wp:list -->
<ul><li>To store data permanently, Kubernetes uses <a href="https://kubernetes.io/docs/concepts/storage/persistent-volumes/" rel="noreferrer noopener" target="_blank">Persistent Volumes</a>.</li><li><em>PersistentVolume</em> (PV) is a piece of storage in the cluster.</li><li>PV is independent of the pod lifecycle.</li><li>They provide a file system that can be mounted to the cluster, without being associated with any particular node.</li></ul>
<!-- /wp:list -->

<!-- wp:paragraph -->
<p><strong>PersistentVolumeClaim</strong>:</p>
<!-- /wp:paragraph -->

<!-- wp:list -->
<ul><li>A PVC is the request to provision persistent storage with a specific type and configuration.</li><li>Applications claim the PV using PVC</li></ul>
<!-- /wp:list -->

<!-- wp:paragraph -->
<p><strong>StorageClass</strong>:</p>
<!-- /wp:paragraph -->

<!-- wp:list -->
<ul><li>To specify the persistent storage flavor that you want, you use <a rel="noreferrer noopener" href="https://cloud.ibm.com/docs/containers?topic=containers-kube_concepts#storageclasses" target="_blank">Kubernetes storage classes</a>.</li><li>When we create a PVC, the request is sent to the storage provider. </li><li>Depending on the configuration that is defined in the storage class, the physical storage device is ordered and provisioned in your application.</li><li>If the requested configuration does not exist, the storage is not created.</li></ul>
<!-- /wp:list -->

<!-- wp:image -->
<figure class="wp-block-image"><img src="https://cdn-images-1.medium.com/max/1600/0*FXOO6Xn1Q-G36fQn.png" alt=""/></figure>
<!-- /wp:image -->

*In case it helped :)*
<a href="https://www.buymeacoffee.com/aseemwangoo" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png" alt="Pass Me A Coffee!!" style="height: 41px !important;width: 174px !important;box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;" ></a>