A new Deployment will take effect when it's applied.
kubectl apply -f deployment.yaml
kubectl get deployment myapp-deployment # to verify the deployment
The kubectl apply
command and the kubectl rollout
command serve different purposes in managing deployments in Kubernetes.
kubectl apply
- Primary Use: The kubectl apply command is used to create or update resources in a Kubernetes cluster. It takes a configuration file (usually in YAML format) and applies it to the cluster. This is the command you use to initially create objects like Deployments, Services, ConfigMaps, etc., or to apply changes to them.