On GKE, a microservice needs read/write access to a Spanner database. To follow security best practices with minimal code changes, how should the application obtain Spanner credentials?
Choose an answer
Tap an option to check your answer.
Correct answer: Use appropriate Google service accounts and enable Workload Identity for the pods..
Why this is the answer
Workload Identity is the recommended and most secure way for applications running on GKE to access Google Cloud services like Spanner. It allows a Kubernetes service account to impersonate a Google Cloud service account, granting the pod the permissions of that Google Cloud service account without needing to store or manage credential files. This minimizes code changes as the application can use standard Google Cloud client libraries which automatically discover credentials. Storing credentials in Kubernetes Secrets is less secure as secrets are base64 encoded, not encrypted by default, and can be accessed by anyone with cluster access. VPC-native clusters are for network connectivity, not authentication. Cloud KMS can secure credentials, but retrieving them for each connection adds complexity and latency compared to Workload Identity's seamless integration.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed