Prepare and test your skills
Prepare and test your skills
Free sample question, answered and explained below. The Professional Cloud DevOps Engineer practice bank has 1,455 more like it. Try 10 free: instant score, no account.
Your team is building a secure CI/CD pipeline using Cloud Build that packages containerized applications and deploys them to Google Kubernetes Engine (GKE). The pipeline has two distinct secret management requirements:
Which configuration strategy should you implement to satisfy both requirements?
roles/secretmanager.secretAccessor to the Cloud Build service account, fetch the database credentials during the build step, and write them to a configuration file inside the container image for runtime access.This option retrieves both build-time and runtime secrets during the CI pipeline phase and bakes the runtime database credentials directly into a configuration file inside the container image filesystem.
The file written inside the container contained non-sensitive static template definitions or public configuration data rather than live database credentials.
--build-arg). For runtime, grant roles/secretmanager.admin to the GKE node pool default Compute Engine service account so all containers can read database credentials.This option passes build secrets via standard Docker build arguments and grants broad administrative permissions to the underlying Compute Engine default service account shared across the GKE node pool.
--build-arg bakes the secret into the Docker image metadata and intermediate layer history, allowing anyone with pull access to inspect and retrieve the sensitive token.roles/secretmanager.admin provides full administrative control (including deleting secrets and modifying IAM policies) rather than read-only access (roles/secretmanager.secretAccessor).The build parameters were non-sensitive environment configurations (like build target IDs) and the service account specifically required full administrative control over Secret Manager lifecycle operations.
cloudbuild.yaml. For runtime, generate a service account private key JSON file, store it in a standard Kubernetes Secret, and mount the key inside the Pod to authenticate to Secret Manager.This option uses plain substitution variables in Cloud Build to store build credentials and uses exported service account JSON keys inside Kubernetes Secrets for runtime authentication.
You were passing non-sensitive build arguments (e.g., commit SHA, tag name) and deploying to an external on-premises cluster where Workload Identity was unavailable.
roles/secretmanager.secretAccessor on the package repository secret to the Cloud Build service account and expose it via availableSecrets in cloudbuild.yaml. For runtime, configure GKE Workload Identity with a dedicated runtime Google Service Account granted roles/secretmanager.secretAccessor on the database secret.This approach uses Secret Manager as the centralized secrets store while strictly separating build-time and runtime execution phases and identities, applying the principle of least privilege through granular Identity and Access Management (IAM) role assignments.
availableSecrets (with secretManager) in cloudbuild.yaml, the secret is exposed only to designated ephemeral build steps via secretEnv. The API key is consumed dynamically during compilation without persisting in the intermediate image layers or final container image artifact.roles/secretmanager.secretAccessor only for the private repository secret, while the application runtime service account is granted roles/secretmanager.secretAccessor only for the database secret.roles/secretmanager.secretAccessor at the individual secret level rather than project-wide.Answer them yourself and get your score the moment you finish. No account needed.
Full access includes
Keep the momentum going with these hand-picked practice scenarios
Last updated Validated