What is a Kubernetes Pod?
Tags: kubernetes, devops, docker, microservices
Published: 2020-02-15 07:13:58

In this article, I’m going to provide an explanation for Kubernetes pods, use cases, and lifecycle, and how to use it to deploy an application. This article assumes you recognize the purpose of the Kubernetes and you’ve got minikube and kubectl installed.

<b>What is a pod in K8S?</b>

Of object models in Kubernetes, the pod is the smallest building block. inside a cluster, a pod represents a system that’s running. The inside of a pod may have one or greater containers. Those within a single pod share:
<ul>
<li>A unique network IP</li>
<li>Network</li>
<li>Storage</li>
<li>Any additional specifications you’ve applied to the pod</li>
</ul>

To get in-Depth knowledge on Kubernetes you can enroll for a live demo on 
<a href="https://onlineitguru.com/kubernetes-training.html"> kubernetes online training </a>

<img src="https://dev-to-uploads.s3.amazonaws.com/i/ibanu7d5kpgbsanbbt5g.png">



Another way to think of a pod — a “logical host” that is specific to your application and holds one or more tightly-coupled containers. For example, say we've got an app-container and a logging-container during a pod.

The only job of the logging-container is to tug logs from the app-container. Locating your containers in a pod eliminates extra communication setup because they are co-located, so everything is local and they share all the resources. This is an equivalent thing as execution on an equivalent physical server during a pre-container world.

There are other things to do with pods, of course. You might have an init container that initializes a second container. Once the second container is up and serving, the first container stops — its job is done.

**Pod model types**

There are two model types of pod you can create:
<ul>
<li><b>One-container-per-pod:</b> This model is the most popular. The post is that the “wrapper” for one container. Since pod is that the smallest object that K8S recognizes, it manages the pods rather than directly managing the containers.</li>

<li><b>Multi-container-pod:</b> during this model, a pod can hold multiple co-located containers that are tightly coupled to share resources. These containers work as a single, cohesive unit of service. The pod then wraps these multi containers with storage resources into one unit. Example use cases include sidecars, proxies, logging.</li>
</ul>

Take your career to new heights of success with <a href="https://onlineitguru.com/kubernetes-training.html"> kubernetes training </a>


Each pod runs one instance of your application. If you would like to scale the app horizontally (such as running several replicas), you’ll use a pod per instance. this is often different from running multiple containers of an equivalent app within one pod.

It is worth mentioning that pods aren’t intended as durable entities. If a node fails or if you’re maintaining nodes, the pods won’t survive. to unravel this issue, K8S has controllers — typically, a pod is often created with a type of controller.

**Pod lifecycle phases**

A pod status tells us where the pod is in its lifecycle. it’s meant to offer you thought not surely, therefore it’s good practice to debug if pod doesn’t come up cleanly. The five phases of a pod lifecycle are:
<ol>
<li><b>Pending:</b> The pod is accepted, but a minimum of one container image has not been created.</li>
<li><b>Running:</b> The pod is sure to a node, and every one container is created. One container is running or in the process of starting or restarting.</li>
<li><b>Succeeded:</b> All containers within the pod successfully terminated and can not restart.</li>
<li><b>Failed:</b> All containers are terminated, with at least one container failing. The failed container exited with a non-zero status.</li>
<li><b>Unknown:</b> The state of the pod couldn’t be obtained.</li>