Which command would patch a deployment config to set the service account name to myserviceaccount?

Prepare for the Red Hat OpenShift Developer II DO288 Exam with our quizzes. Study with flashcards and multiple choice questions, each with hints and explanations. Get ready for your certification!

Multiple Choice

Which command would patch a deployment config to set the service account name to myserviceaccount?

Explanation:
The key idea is updating the service account for pods created by the DeploymentConfig, which lives in the pod template inside the DeploymentConfig. To change it, you patch the field at spec.template.spec.serviceAccountName with the desired value. The correct patch does exactly that: it targets spec.template.spec.serviceAccountName and sets it to "myserviceaccount". This aligns with where OpenShift stores the pod’s service account in a DeploymentConfig. The other options fail because they either place the field in the wrong level (for example, setting serviceAccountName at the template level rather than inside template.spec), use a different field name (serviceAccountName vs serviceAccount), or have invalid JSON structure (such as an extra brace or incorrect nesting).

The key idea is updating the service account for pods created by the DeploymentConfig, which lives in the pod template inside the DeploymentConfig. To change it, you patch the field at spec.template.spec.serviceAccountName with the desired value.

The correct patch does exactly that: it targets spec.template.spec.serviceAccountName and sets it to "myserviceaccount". This aligns with where OpenShift stores the pod’s service account in a DeploymentConfig.

The other options fail because they either place the field in the wrong level (for example, setting serviceAccountName at the template level rather than inside template.spec), use a different field name (serviceAccountName vs serviceAccount), or have invalid JSON structure (such as an extra brace or incorrect nesting).

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy