Soru

Zorluk: KolayProgrammatic GCP Interaction via SDK, CLI, and APIs

An enterprise development team is deploying an automated Python application inside a Google Kubernetes Engine (GKE) Pod. The application needs to programmatically upload archived files to a Cloud Storage bucket using the official Google Cloud Python Client Library. Which TWO actions should the team take to securely authenticate and execute these API calls? (Select TWO)

  1. Configure Workload Identity on the GKE cluster and map the Kubernetes Service Account to a Google IAM Service Account configured with least-privilege storage permissions.Cevap
  2. Initialize the Cloud Storage client in the application code without passing explicit key paths, relying on Application Default Credentials (ADC) to detect runtime credentials.Cevap
  3. C
    Generate a service account JSON key file and hardcode the key directly within the container image or application source repository.
  4. D
    Assign the primitive Owner role (roles/owner) to the underlying service account so the application can bypass API scope restrictions.

Cevap

The correct practices are to bind the Kubernetes Service Account to a Google IAM Service Account using Workload Identity, and to instantiate the client library relying on Application Default Credentials (ADC).
Enabling Workload Identity maps the Kubernetes Service Account to a Google Cloud IAM Service Account, providing secure short-lived identity tokens to the Pod. Relying on Application Default Credentials (ADC) inside the Python client library allows the SDK to automatically discover these tokens without hardcoded credentials or manual token handling.

Adım Adım Çözüm

1
Identify the authentication mechanism for GKE Pods accessing GCP APIs.
Workload Identity provides short-lived tokens directly to Pods, eliminating service account key management.
This is the recommended security pattern for GKE applications invoking GCP APIs.
2
Determine how the client library should discover credentials.
Instantiating the client without explicit credential arguments enables Application Default Credentials (ADC) to resolve the environment identity automatically.
ADC ensures portable, secure programmatic authorization across Google Cloud environments.

Anahtar Kavram

Workload Identity and Application Default Credentials (ADC) for secure SDK interaction
Bu soruyu puanla