dev-resources.site
for different kinds of informations.
CKA Recap -- Deployment
Published at
1/5/2025
Categories
kubernetes
cka
deployment
rollout
Author
cheedge_lee
Author
11 person written this
cheedge_lee
open
Deployment
Basic CMD
# Create
kubectl create deploy NAME --image=IMAGE --replica NUM
# Scale (or use kubectl edit)
kubectl scale deploy NAME --replicas NUM
# Change image of deploy
kubectl set image deployments/DP_NAME ContainerName=IMAGE
k set image deployments/apache httpd=httpd:alpine
When using
kubectl create
cmd create the deployment, it will automatically add the samelabels
for both deployment and pods. So if you want to customize thelabel
, it's better to print out--dry-run=client -oyaml
the yaml file and have a check.
And if not clear the container name, can use following to find it
k get pod NAME -oyaml | grep -3 -i container
Rollout
k rollout history deployment/DP_NAME
k rollout history deployment/DP_NAME --revision REV_NUM
k rollout undo deployment/DP_NAME --to-revision REV_NUM
k rollout status deployment DP_NAME
controlplane $ k rollout history deployment video-app
deployment.apps/video-app
REVISION CHANGE-CAUSE
1 <none>
2 <none>
3 <none>
controlplane $ k rollout history deployment/video-app --revision 3
deployment.apps/video-app with revision #3
Pod Template:
Labels: app=video-app
pod-template-hash=69648db755
Containers:
redis:
Image: redis:7.0.13
Port: <none>
Host Port: <none>
Environment: <none>
Mounts: <none>
Volumes: <none>
Node-Selectors: <none>
Tolerations: <none>
controlplane $ k rollout undo deployment/video-app --to-revision 3
deployment.apps/video-app skipped rollback (current template already matches revision 3)
Rolling Strategy
.spec.strategy.rollingUpdate.Unavailable
and .spec.strategy.rollingUpdate.maxSurge
- Max Unavailable
- unavailable during the update process.
- Max Surge
- specifies the maximum number of Pods that can be created over the desired number of Pods
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 30%
maxUnavailable: 45%
.spec.strategy.type==Recreate
, and we can also destroy all existing pods first then create the new pods.
strategy:
type: Recreate
cka Article's
30 articles in total
Turning Markdown into Learning: publishing a challenge on labs.iximiuz.com
read article
CKA Quick Check Points -- RBAC
read article
CKA Quick Check Points -- Network
read article
CKA Quick Check Points -- Logs & Configs
read article
CKA Recap -- Deployment
currently reading
ClusterIP vs. NodePort
read article
CKA Recap -- Ingress & NetworkPolicy
read article
Kubernets Storage Demos
read article
3. CKA Storage
read article
Why must a Kubernetes cluster have an odd number of nodes
read article
Understanding Pod Topology Spread Constraints in Kubernetes
read article
Deployments and Replica Sets in Kubernetes
read article
40 days of Kubernetes: Docker Fundamentals
read article
Understanding Kubernetes Pods and YAML Fundamentals
read article
Creating a Kubernetes Cluster with Kubeadm and Containerd: A Comprehensive Step-by-Step Guide
read article
Mastering Multi-Stage Builds in Docker 🚀
read article
Mastering Docker Fundamentals: The First Step in Becoming a Certified Kubernetes Administrator
read article
How I Passed the Certified Kubernetes Administrator (CKA) Exam and How You Can Too
read article
AWS EKS Ingress - Canary
read article
Certified Kubernetes Administrator (CKA) Prep.
read article
Certified Kubernetes Administrator (CKA) - Several Successful Story
read article
YouTube 13k Subscriber crossed! Exciting Giveaway
read article
How to Pass the Certified Kubernetes Administrator Examination
read article
'Kubernetes Complete Course In 10 Hours' – your ultimate beginner's guide to Kubernetes FREE!
read article
Kubernetes CKA Exam Question Bank .. 17 Questions with Complete Lab .. In 3 hours .. FREE!
read article
ROAD TO CKA [Certified Kubernetes Administrator ]-Core Concept- Pod(Day-7)
read article
ROAD TO CKA [Certified Kubernetes Administrator ]-Kubernetes Architecture(Day-4)
read article
Installing Kubernetes-1.27.0 in Ubuntu 22.04
read article
ROAD TO CKA [Certified Kubernetes Administrator ]-What Kubernetes is & is not?(Day-3)
read article
ROAD TO CKA [Certified Kubernetes Administrator ]-Core Concept- Control Plane/Master Node (Day-5)
read article
Featured ones: