Kubernetes is an open-source platform for automating the deployment, scaling, and management of containerized applications. At the heart of Kubernetes are pods, the smallest and simplest unit in the Kubernetes object model. In this blog, we will introduce you to the basics of Kubernetes pods and how they play a crucial role in managing containerized applications.
What are Kubernetes Pods?
A Kubernetes pod is the smallest and simplest unit in the Kubernetes object model. A pod contains one or more containers that run the same application. Pods provide a way to manage the resources required by the containers and ensure that they are isolated from one another. This means that containers within a pod share the same network namespace, making it easier to communicate with each other using localhost.
Simple Architecture of Pod:
Basic key points:
Pods are the smallest deployable units in the Kubernetes cluster.
Most pods have a 1:1 Pod Container ratio.
Pods with multi-container are called multi-container pods.
Images for container creation are obtained from the registry.
A service makes communication between pods possible.
Kubelet ensures that containers are running and healthy.
Kube-proxy manages the networking needs of the pods.
How one can create a pod?
If we want to create a pod firstly we have to write a simple YAML file that contains the information to create a pod with that specification. Then we can give YAML file as an argument with the command and creates a pod.
If you are not familiar with what YAML files are, check out here my detailed blog on YAML, link - Getting started with YAML
Example of YAML file to create pod
apiVersion: v1
kind: Pod
metadata:
name: jenkins-pod
labels:
env: production
spec:
containers:
- name: jenkins
image: jenkins/jenkins
Commands to create the pod:
# to create pod
kubectl create -f pod.yaml
# to get information about perticular pod
kubectl describe pod pod-name
# to get list of all pods
kubectl get pods
# shows metrics of pod as CPU and Memory (Bytes)
kubectl top pod
# to delete a perticular pod
kubectl delete pod pod-name
Resources
To learn more about pods and explore more Kubernetes concepts only thing is get started and learn by doing! So why are you stopping, go and open your laptop and do some hands-on practice to create pods? All the very best to you 👍
❤️ Thank you very much for reading ❤️
If you find the blog useful don't forget to like, share, and comment.
If I miss out on anything feel free to comment
Feel free to comment your views in the comment section.
Connect with me on Twitter
Happy Learning 😊!