Understanding kubectl apply vs create
📖 Scenario: You are managing a Kubernetes cluster. You want to deploy an application using YAML files. You need to understand the difference between kubectl create and kubectl apply commands to manage your resources effectively.
🎯 Goal: Learn how to create a Kubernetes deployment using kubectl create and then update it using kubectl apply. See how these commands behave differently when managing resource changes.
📋 What You'll Learn
Create a Kubernetes deployment YAML file named
nginx-deployment.yaml with specified contentUse
kubectl create to create the deployment from the YAML fileModify the YAML file to change the number of replicas
Use
kubectl apply to update the deployment with the new replica countObserve the output of both commands
💡 Why This Matters
🌍 Real World
Kubernetes is widely used to deploy and manage containerized applications. Knowing how to create and update resources with kubectl commands is essential for daily cluster operations.
💼 Career
DevOps engineers and site reliability engineers use these commands to manage application deployments, updates, and rollbacks in production environments.
Progress0 / 4 steps