CKA · Question #39
Schedule a pod as follows: • Name: nginx-kusc00401 • Image: nginx • Node selector: disk=ssd
The task requires creating a Kubernetes Pod with a specific name, image, and node selector, by editing a YAML file in a web terminal and applying it.
Question
Explanation
The task requires creating a Kubernetes Pod with a specific name, image, and node selector, by editing a YAML file in a web terminal and applying it.
Approach. The question asks to 'Schedule a pod' with specific attributes (Name: nginx-kusc00401, Image: nginx, Node selector: disk=ssd). This requires creating a Kubernetes Pod object, not modifying or creating a Deployment. The most direct approach in the given web terminal environment is to modify the existing app.yaml file to contain a Pod definition, or create a new YAML file for the Pod, and then apply it using kubectl.
Common mistakes.
- common_mistake. Common mistakes include modifying the existing
Deploymentinstead of creating aPodobject. For example, changing theDeployment's Pod template to includenodeSelectorand modify the image. This is incorrect because the question specifically asks for a 'pod', implying a standalonekind: Podobject, not a deployment that manages pods. Additionally, a Deployment's pod names are generated, not directly set bymetadata.namein its template to match the specificnginx-kusc00401. Other mistakes include incorrect YAML syntax (indentation, spelling, case sensitivity), placingnodeSelectorat the wrong YAML level (e.g., directly undermetadataorcontainers), using thenginx:1.11.10-alpineimage from the originalapp.yamlinstead ofnginx, or forgetting to save and apply the changes.
Concept tested. Kubernetes Pod creation, YAML manifest structure (apiVersion, kind, metadata, spec), container definition (name, image), and node scheduling using nodeSelector for targeted placement of pods on specific nodes based on labels.
Reference. https://kubernetes.io/docs/concepts/workloads/pods/ and https://kubernetes.io/docs/concepts/scheduling-and-priority/assign-pod-node/
Topics
Community Discussion
No community discussion yet for this question.