Launching your Kubernetes Cluster with Deployment
What is Deployment in k8s
A Deployment provides a configuration for 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 replicas for scaling, or to remove existing Deployments and adopt all their resources with new Deployments.
Today's task let's keep it very simple.
Task-1:
Create one Deployment file to deploy a sample todo-app on K8s using "Auto-healing" and "Auto-Scaling" feature
add a deployment.yml file (sample is kept in the folder for your reference)
apply the deployment to your k8s (minikube) cluster by command
kubectl apply -f deployment.yml
Creating namespace.
- kubectl create namespace django-ns
View namespace.
- kubectl get namespace
Create deployment.yaml and view.
- vim deployment.yaml
- cat deployment.yaml
Applying the configuration od deployment.yaml file.
- kubectl apply -f deployment.yaml
View pods created with deployment file
- kubectl get pods -n django-ns
Deleting a pod
- kubectl delete pod django-deployment-6fcf5458b5-4tzqx -n django-ns
View pods
- kubectl get pods -n django-ns : (One pod is terminating and another pod is creating automatically to get the desired state (3 pods) mentioned in the deployment, and this feature is called "Auto Healing")
Changing the replicas to 4 in the deployment"
- vim deployment.yaml
- cat deployment.yaml
Apply the edited deployment
- kubectl apply -f deployment.yaml
View pods
- kubectl get pods -n django-ns: (Pods have been scaled to the desired state (4 pods) mentioned in the deployment file.
Let's make your resume shine with one more project ;)
Having an issue? Don't worry, adding a sample deployment file , you can always refer that or wathch this video
Happy Learning :)




