Which command is used to create a Kubernetes job named 'calculatepi'?

Prepare for the Kubernetes Cloud Native Associate (KCNA) Certification test with engaging questions and detailed explanations. Perfect your knowledge and boost your confidence to pass the exam successfully!

Multiple Choice

Which command is used to create a Kubernetes job named 'calculatepi'?

Explanation:
A Job in Kubernetes runs one or more pods to completion, making it ideal for batch tasks like calculating pi. To create such a Job directly and name it, you use the create job form of kubectl: kubectl create job calculatepi. This explicitly tells Kubernetes you want a Job resource with that name, and you typically accompany it with the container image you want to run (for example, kubectl create job calculatepi --image=python:3.11-slim with the appropriate command). The other options aren’t as direct for creating a Job. Kubectl run is geared toward creating pods (or deployable controllers) by default, unless extra flags are used, so it’s not the straightforward way to define a Job resource. kubectl apply -f calculatepi.yaml would apply a manifest, which could create a Job if the YAML defines one, but it requires a predefined file. kubectl create pod is not a standard command for creating a Pod in typical usage. The clearest, most explicit command to create a Job named calculatepi is kubectl create job calculatepi.

A Job in Kubernetes runs one or more pods to completion, making it ideal for batch tasks like calculating pi. To create such a Job directly and name it, you use the create job form of kubectl: kubectl create job calculatepi. This explicitly tells Kubernetes you want a Job resource with that name, and you typically accompany it with the container image you want to run (for example, kubectl create job calculatepi --image=python:3.11-slim with the appropriate command).

The other options aren’t as direct for creating a Job. Kubectl run is geared toward creating pods (or deployable controllers) by default, unless extra flags are used, so it’s not the straightforward way to define a Job resource. kubectl apply -f calculatepi.yaml would apply a manifest, which could create a Job if the YAML defines one, but it requires a predefined file. kubectl create pod is not a standard command for creating a Pod in typical usage. The clearest, most explicit command to create a Job named calculatepi is kubectl create job calculatepi.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy