Using the OpenShift CLI, which command would you use to set a readiness probe on a deployment named phpapp with port 8080 and the /healthz endpoint, checking every 30 seconds?

Prepare for the Red Hat Openshift Developer EX288 Exam. Study with comprehensive quizzes and flashcards. Each question includes hints and explanations to enhance your understanding. Ace your exam with confidence!

Multiple Choice

Using the OpenShift CLI, which command would you use to set a readiness probe on a deployment named phpapp with port 8080 and the /healthz endpoint, checking every 30 seconds?

Explanation:
Configuring readiness probes is done with the oc set probe command. This command directly updates the pod template of the target resource to include the specified readiness (or liveness) probe, making it the most straightforward way to add health checks to an existing deployment. For this scenario, you would enable a readiness probe and define an HTTP GET to the health endpoint, using port 8080 and a 30-second interval. A typical invocation would look like oc set probe deployment/phpapp --readiness --http-get='path=/healthz,port=8080' --period-seconds=30. This approach cleanly expresses the desired health check without needing to craft a patch payload or apply a separate manifest. Other options don’t fit because there isn’t a subcommand named to set readiness directly, and while you could patch or apply a manifest to achieve the same result, those methods are more verbose or indirect for configuring probes.

Configuring readiness probes is done with the oc set probe command. This command directly updates the pod template of the target resource to include the specified readiness (or liveness) probe, making it the most straightforward way to add health checks to an existing deployment.

For this scenario, you would enable a readiness probe and define an HTTP GET to the health endpoint, using port 8080 and a 30-second interval. A typical invocation would look like oc set probe deployment/phpapp --readiness --http-get='path=/healthz,port=8080' --period-seconds=30. This approach cleanly expresses the desired health check without needing to craft a patch payload or apply a separate manifest.

Other options don’t fit because there isn’t a subcommand named to set readiness directly, and while you could patch or apply a manifest to achieve the same result, those methods are more verbose or indirect for configuring probes.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy