Table of contents
What is Pod in k8s?
A Pod (as in a pod of whales or pea pod) is a group of one or more containers, with shared storage and network resources, and a specification for how to run the containers. A Pod's contents are always co-located and co-scheduled, and run in a shared context. A Pod models an application-specific "logical host": it contains one or more application containers that are relatively tightly coupled. In non-cloud contexts, applications executed on the same physical or virtual machine are analogous to cloud applications executed on the same logical host.
What is Deployment in k8s?
A Deployment provides declarative updates for Pods and ReplicaSets.
You describe a desired state in a Deployment, and the Deployment Controller changes the actual state to the desired state at a controlled rate. You can define Deployments to create new ReplicaSets or to remove existing Deployments and adopt all their resources with new Deployments.
Here are the key aspects of a Kubernetes Deployment:
Desired State
Rolling Updates and Rollbacks
Scaling
High Availability
Self-healing
Task:
Create one Deployment file to deploy a sample todo-app on K8s using the "Auto-healing" and "Auto-Scaling" feature
First set up the Kubernetes cluster with the master node and the worker node.
now create a manifest file for our nodo-todo application
apiVersion: apps/v1
kind: Deployment
metadata:
name: todo-app
labels:
app: todo
spec:
replicas: 2
selector:
matchLabels:
app: todo
template:
metadata:
labels:
app: todo
spec:
containers:
- name: todo
image: rishikeshops/todo-app
ports:
- containerPort: 3000
Create the deployment using kubectl apply -f todo-deployment.yml
Scale the replicas of deployment if required
Here I have scaled the replicas to 2,
using
kubectl scale --replicas=2 deploy/todo-deployment.yml
So I encourage you to try this on your own and let me know in the comment section about your learning experience
Thank you for reading!
Thank You! Stay Connected โ๏ธ๐ฉโ๐ป๐
Contact me at :
LinkedIn: linkedin.com/in/akash-singh-48689a176
E-mail: akashsingh6474@gmail.com