Kubernetes Deployment

My name is Shyju Krishnan having 10+ Years of experience as an IT infrastructure/Solution Architect
Search for a command to run...

My name is Shyju Krishnan having 10+ Years of experience as an IT infrastructure/Solution Architect
No comments yet. Be the first to comment.
In this series, i will brainstorm basic to advanced topics with examples,with commands,with usecases
After reading this post you will be understanding the high level of Kubernetes Secrets and ConfigMap, its advantages of this, and basic kubectl commands related to Secret and ConfigMap If you have not yet checked the previous parts of this series, p...
API (Application Programming Interface) security is critical for protecting sensitive data and maintaining the integrity of systems and applications. APIs are used to connect different systems and applications, and as a result, they can provide a gat...

Well after months of deep slumber, away from social media networks, I had to return to Pune and adapt to hybrid working. I was browsing through meetup.com and was intrigued by one event from AWS user group Pune. It is AWS Reinvent 2022 -Recap on 21st...

Episode 2

Simplify Access Control and Enhance Transparency Over Your ML Projects

Episode 1

After reading this post you will be understanding the high level of Kubernetes Deployments, its advantages of this, and basic kubectl commands related to Deployments
If you have not yet checked the previous parts of this series, please go ahead and check this 👉Link
In Kubernetes, Deployment is used to provide declarative updates to Pods as well as ReplicaSets. Also, a Deployment Controller is the higher version of a Replication Controller, as it Removes, Adds, and Updates Pods in ReplicaSets. We need this to work faster and dynamically when we have ReplicaSets with tens of pods, and we are in need to modify them. By using Kubernetes Deployment, this can be achieved with very little effort if used in a correct way.
Deployment sits top of the Kubernetes hierarchy layer. First Pod, then Replica Set, and then Deployment. By using Deployment we can easily upgrade the Pod instances using rolling update and we can easily undo the changes. So Deployment in the Kubernetes cluster is very flexible and gives us more value
Note: During the upgradation, time application is not available This is not the default deployment strategy
This diagram will help you to understand the application and Database deployment in the Kubernetes cluster

Create Deployment YAML File
apiVersion: apps/v1
kind: Deployment
metadata:
name: nodeapp-deployment
labels:
app: nodeapp
type: front-end
spec:
template:
metadata:
name: nodejsapp-pod
labels:
app: nodejsapp
type: front-end
spec:
containers:
- name: nodejsapp-erp
image: nginx:1.16.1
replicas: 3
selector:
matchLabels:
type: front-end
How to test the deployment status ( you need to check this three status)
kubectl get deploy
kubectl get rs
kubectl get pod
Upgrading the Nginx version
kubectl set image deployment/nodeapp-deployment nodejsapp-erp=nginx:1.19.1
you can upgrade the version through the YAML file, change a particular version value and run kubectl apply -f
Rollout the version
kubectl rollout undo deployment/test-deploy --to-revision=2
Rollout history showing command
kubectl rollout history deployment/test-deploy
How to check the rollout status
kubectl rollout status deployment/test-deploy
Hope you have got an idea about Kubernetes Deployment and how we can implement them in our product environments
Happy Learning 📚
Thank you for reading!!!