Configuring and Managing Pods in Kubernetes Clusters (K8s): Deep diving into Kubernetes.

Rushi Trivedi
3 min readOct 21, 2020
Pod Configuration in an K8s cluster

As in my previous blog of Kubernetes (DevOps Series) we have already covered all the fundamentals required for kubernetes.

In this blog, I will be heading towards how to configure and manage an pod or n numbers of pods in Kubernetes Cluster(s) or K8s, in short we will take an deep dive into Kubernetes.

As we all know that Pod is a smallest and fundamental unit of K8s application. Pod is nothing but representation of processes ( can be containers) running on K8s cluster. A pod is collection of containers and its storage inside a node of kubernetes cluster.

It is always possible to create a pod with Multiple containers inside it in a K8s cluster.

For example: we can have a DataBase Container and the Application Container in a same pod.

Types of Pods in K8s

In general there are two types of Pods in K8s cluster.

  1. Single container pod
  2. Multi container pod

Single Container Pod in K8s

For configuration of single container in pod and running the same we can simply create with kubectl run command,where we have an image that is defined on the Docker registry. We will create a pod by pulling the image from docker hub.

Single container Pod

We will create a pod with a tomcat image which is available online in docker hub registry

$ kubectl run tomcat — image = tomcat:8.0

It can also be done by creating the YAML file and then running command kubectl create.

apiVersion: v1
kind: Pod
metadata:
name: Tomcat
spec:
containers:
- name: Tomcat
image:tomcat: 8.0
ports:
containerPort: 7500
imagePullPolicy: Always

As soon as the above yaml file is created , we will be saving this file with tomcat.yaml and run the command to create it

$ kubectl create –f tomcat.yml

This command will provision a pod with nomenclature Tomcat.we can check status after with Kubectl command to describe pods.

Multi Container Pod in K8s

Multi container pod

Unike single container pod, here in multi container pod, we only have one option here i.e. provisioned Multi-container-Pods using Yaml file.

apiVersion: v1
kind: Pod
metadata:
name: Tomcat
spec:
containers:
- name: Tomcat
image: tomcat: 8.0
ports:
containerPort: 7500
imagePullPolicy: Always
-name: Database
Image: mongoDB
Ports:
containerPort: 7501
imagePullPolicy: Always

Above we have provisioned two containers inside a single POD
1. Tomcat (Container1)
2. MongoDB (Container2).

For more details on basics of K8s and architectural analysis of K8s, refer:

— — — — — — — — — — — —Thank You — — — — — — — — — — — — — — —

--

--

Rushi Trivedi

Full Stack Developer || Application and Software Developer || DevOps Engineer || Ex-Oracle || M.Tech. CSE