Practical Guide to Kubernetes Controllers, Deployments, and Rollouts
This article explains Kubernetes controllers, the relationship between pods and controllers, deployment use cases, YAML file handling, and provides step‑by‑step kubectl commands for creating, exposing, scaling, upgrading, and rolling back deployments in a cloud‑native environment.
1. What is a controller? A controller is an object that manages and runs containers in a Kubernetes cluster.
2. Relationship between pod and controller Pods are managed by controllers to achieve operations such as scaling and rolling updates. The link between a pod and its controller is established through label and selector tags.
3. Deployment controller use cases Deploying stateless applications, managing pods and ReplicaSet, performing rolling updates, and supporting web services or micro‑service architectures.
4. YAML file field description (Details omitted for brevity).
5. Basic kubectl commands for deployments
kubectl delete deployment web kubectl get pods,svcStep‑by‑step deployment process
Step 1: Export the YAML file
kubectl create deployment web --image=nginx --dry-run -O yaml > web.yamlStep 2: Apply the YAML file to create the deployment kubectl apply -f web.yaml Step 3: Verify the deployment is running kubectl get pods Step 4: Expose the deployment externally
kubectl expose deployment web --port=80 --type=NodePort --target-port=80 --name=web1 -O yaml > nginx.yaml kubectl apply -f nginx.yamlStep 5: Upgrade the image version kubectl set image deployment web nginx=nginx:1.18 Check upgrade status kubectl rollout status deployment web Rollback history kubectl rollout history deployment web Undo the latest rollout kubectl rollout undo deployment web Rollback to a specific revision (e.g., revision 2) kubectl rollout undo deployment web --to-revision=2 7. Scaling the deployment
kubectl scale deployment web --replicas=10Additional reference links are provided for related topics such as Prometheus, Grafana, Harbor, and Docker‑based Apollo projects.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Practical DevOps Architecture
Hands‑on DevOps operations using Docker, K8s, Jenkins, and Ansible—empowering ops professionals to grow together through sharing, discussion, knowledge consolidation, and continuous improvement.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
