Complete the command to check the status of pods in the default namespace.
kubectl get pods --namespace=[1]The default namespace is where most pods run unless specified otherwise. Using default shows pods in that namespace.
Complete the command to describe a pod named 'myapp-pod' to find why it is Pending.
kubectl describe pod [1]The pod name must be exact to get detailed info. 'myapp-pod' is the correct pod name here.
Fix the error in this YAML snippet to request CPU resources correctly for a pod.
resources:
requests:
cpu: [1]CPU requests in Kubernetes are specified in millicores, like '100m' for 0.1 CPU core.
Fill both blanks to create a node selector that schedules pods only on nodes labeled with environment=production.
nodeSelector: [1]: [2]
Node selectors use key-value pairs. Here, key is 'environment' and value is 'production' to select production nodes.
Fill all three blanks to create a pod affinity rule that prefers nodes in the 'us-east' zone with label 'zone=us-east'.
affinity:
podAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: [1]
podAffinityTerm:
labelSelector:
matchExpressions:
- key: [2]
operator: In
values:
- [3]The weight defines preference strength (100 is max). The key is 'zone' and the value is 'us-east' to prefer those nodes.