CKAD — API Deprecations & Monitoring
API Deprecations
Kubernetes regularly deprecates old API versions. If your manifests use deprecated APIs, they may stop working after a cluster upgrade.
Check API Versions
# List all available API resources
kubectl api-resources
# Check a specific resource's API version
kubectl api-resources | grep deployment
# Expected: deployments deploy apps/v1 true Deployment
# Check if a specific API is available
kubectl get --raw /apis/apps/v1 | head
Common API Changes
| Old API | New API | Resource |
|---|---|---|
extensions/v1beta1 |
networking.k8s.io/v1 |
Ingress |
extensions/v1beta1 |
apps/v1 |
Deployment |
batch/v1beta1 |
batch/v1 |
CronJob |
rbac.authorization.k8s.io/v1beta1 |
rbac.authorization.k8s.io/v1 |
Role, ClusterRole |
Using kubectl explain
kubectl explain is your best friend on the exam — it shows the correct API version and field structure for any resource:
# Check the current API version for a resource
kubectl explain deployment
# KIND: Deployment VERSION: apps/v1
# Explore specific fields
kubectl explain pod.spec.containers.livenessProbe
kubectl explain deployment.spec.strategy
# Recursive documentation
kubectl explain pod.spec --recursive | grep -i volume
Exam tip: Use kubectl explain during the exam to check field names and API versions. It is faster than looking up documentation.
Monitoring with Metrics
metrics-server
The metrics-server collects resource usage data from kubelets and exposes it through the Kubernetes API.
# Check if metrics-server is installed
kubectl get deployment metrics-server -n kube-system
# View Pod resource usage
kubectl top pods
kubectl top pods -n kube-system
kubectl top pods --sort-by=cpu
kubectl top pods --sort-by=memory
# View node resource usage
kubectl top nodes
# Expected output:
# NAME CPU(cores) MEMORY(bytes)
# worker-1 250m 1024Mi
# worker-2 180m 768Mi
Identifying Resource-Heavy Pods
# Find Pods using the most CPU
kubectl top pods --sort-by=cpu | head -5
# Find Pods using the most memory
kubectl top pods --sort-by=memory | head -5
# Check a specific Pod
kubectl top pod my-pod --containers
# Shows per-container resource usage
Exam tip: kubectl top requires the metrics-server. It’s pre-installed in the exam environment. Use --sort-by=cpu or --sort-by=memory to quickly find resource-heavy Pods.
Next: Hands-On Lab