CKAD — Service Commands Cheat Sheet
Service Commands Cheat Sheet
# Create
kubectl create service clusterip my-svc --tcp=80:8080
kubectl expose deployment web --port=80 --target-port=8080
kubectl expose pod my-pod --port=80 --type=NodePort
# View
kubectl get svc
kubectl get svc -o wide # Shows selector
kubectl describe svc web
kubectl get endpoints web
# Edit
kubectl edit svc web
kubectl patch svc web -p '{"spec":{"type":"NodePort"}}'
# Delete
kubectl delete svc web
Next: Hands-On Lab →