Which command patches a deployment config to use a new service account named '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 patches a deployment config to use a new service account named 'myserviceaccount'?

Explanation:
Patching a DeploymentConfig to set which service account its pods run under requires updating the pod template inside the DC. For a DeploymentConfig, the service account name is defined at spec.template.spec.serviceAccountName. The patch should target that exact path, updating it to the new value. The command that does this uses a JSON patch that sets spec.template.spec.serviceAccountName to the desired name, which correctly updates the DC’s pod template. This ensures that newly created pods will run with myserviceaccount. The other forms place the field at the wrong level (for example, spec.template.serviceAccountName would not correspond to the DeploymentConfig’s pod template) or omit the inner spec, or patch a Deployment resource instead of a DeploymentConfig.

Patching a DeploymentConfig to set which service account its pods run under requires updating the pod template inside the DC. For a DeploymentConfig, the service account name is defined at spec.template.spec.serviceAccountName. The patch should target that exact path, updating it to the new value.

The command that does this uses a JSON patch that sets spec.template.spec.serviceAccountName to the desired name, which correctly updates the DC’s pod template. This ensures that newly created pods will run with myserviceaccount.

The other forms place the field at the wrong level (for example, spec.template.serviceAccountName would not correspond to the DeploymentConfig’s pod template) or omit the inner spec, or patch a Deployment resource instead of a DeploymentConfig.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy