Day 8 of 40 Days of Kubernetes: Replication Controller, ReplicatSet and Deployment ??
Eric Mwakazi
Software Developer| Docker & Kubernetes | Linux | Cloud & DevOps Enthusiast |
For Day 8/40 of the #40daysofkubernetes challenge, I focused on creating and managing Kubernetes ReplicaSets and Deployments. Here’s a breakdown of what I learned and the steps I took:
ReplicaSet
Creating a ReplicaSet:
I created a new ReplicaSet based on the nginx image with 3 replicas using the following command:
kubectl create replicaset nginx --image=nginx --replicas=3
Updating the ReplicaSet
kubectl scale replicaset nginx --replicas=6
Deployment
Creating a Deployment:
I created a Deployment named nginx with 3 replicas using nginx:1.23.0 and applied the label tier=backend to the Deployment, and app=v1 to the Pod template:
kubectl create deployment nginx --image=nginx:1.23.0 --replicas=3 --labels="tier=backend"
Updating the Deployment:
I updated the image to nginx:1.23.4 and ensured the update was rolled out across all replicas:
领英推荐
kubectl set image deployment/nginx nginx=nginx:1.23.4
kubectl rollout status deployment/nginx
Managing the Rollout:
After assigning a rollout cause "Pick up patch version", I checked the deployment history and reverted back to the first revision to ensure all replicas reverted to nginx:1.23.0:
kubectl rollout history deployment/nginx
kubectl rollout undo deployment/nginx --to-revision=1
Troubleshooting YAML Issues:
I encountered and resolved common YAML errors while deploying new resources and documenting every command I ran during the troubleshooting.
Key Takeaways:
?? Check out the video for Day 6 here: Watch Now
References:
Share Your Learnings
I encourage you to share your learnings publicly. Feel free to connect and tag me @Eric mwakazi, @PiyushSachdeva and @CloudOps Community, and use the hashtag #40daysofkubernetes.