mirror of
https://github.com/lemeow125/Notes.git
synced 2025-01-19 02:43:01 +08:00
1.3 KiB
1.3 KiB
- Get all
pods
kubectl get pods
- Get all
replicacontrollers
kubectl get replicacontrollers
- Get all
replicasets
kubectl get replicasets
- Describe a specific resource (ex. Describe a
deployment
namedmyapp-deployment
)
kubectl describe deployment/myapp-deployment
# This works too
kubectl describe deployment myapp-deployment
- Get specific resource information in wide format
kubectl describe deployment/myapp-deployment -o wide
- Create a
deployment
kubectl create -f deployment.yml
- Update a deployment
kubectl apply -f deployment.yml
- Check rollout/deployment history
kubectl rollout history deployment/myapp-deployment
- Update a deployment, tracking changes (deprecated)
kubectl apply -f deployment.yml --record
- Update a deployment using
annotate
(Note: Changes toscale
will not create a newdeployment
. Annotating after this may result in the message for the previousdeployment
being replaced)
# This assumes you've annotated the previous deployment already
kubectl apply -f deployment.yml
# Annotate the new deployment
kubectl annotate deployment/myapp-deployment kubernetes.io/change-cause="DESCRIBE_CHANGES_HERE"
# You can then view the rollout history
kubectl rollout history deployment/myapp-deployment