Soru

Zorluk: OrtaDeploying Serverless Applications with Cloud Run and Cloud Functions

A cloud administrator needs to deploy a containerized data ingestion service named telemetry-ingest to Google Cloud Run. The container listens on the default port 8080 and must execute under a dedicated, non-default service account named [email protected] to interact securely with backend resources. Which gcloud command should the administrator run to deploy the container image gcr.io/prod-data-project/telemetry-ingest:v1 with the correct identity configuration?

  1. gcloud run deploy telemetry-ingest --image=gcr.io/prod-data-project/telemetry-ingest:v1 --service-account=ingest-worker@prod-data-project.iam.gserviceaccount.comCevap
  2. B
    gcloud run deploy telemetry-ingest --image=gcr.io/prod-data-project/telemetry-ingest:v1 --port=80 --service-account=ingest-worker@prod-data-project.iam.gserviceaccount.com
  3. C
    gcloud functions deploy telemetry-ingest --image=gcr.io/prod-data-project/telemetry-ingest:v1 --service-account=ingest-worker@prod-data-project.iam.gserviceaccount.com
  4. D
    gcloud run deploy telemetry-ingest --image=gcr.io/prod-data-project/telemetry-ingest:v1 --service-account=roles/owner

Cevap

The command 'gcloud run deploy telemetry-ingest --image=gcr.io/prod-data-project/telemetry-ingest:v1 --service-account=ingest-worker@prod-data-project.iam.gserviceaccount.com' correctly deploys the container image while attaching the custom execution service account.
The correct command uses 'gcloud run deploy' with the container image URI and attaches the custom service account email using the '--service-account' flag, matching Cloud Run deployment specifications.

Adım Adım Çözüm

1
Identify the target serverless service type
Since the workload is a pre-built container image, Google Cloud Run is the appropriate serverless compute platform.
Cloud Run natively executes container images, whereas Cloud Functions targets source code functions.
2
Determine the required gcloud command flags for identity configuration
Use the --service-account flag followed by the full service account email address.
Attaching a custom service account adheres to the principle of least privilege for backend GCP resource authorization.
3
Verify default port configuration requirements
Do not pass a custom --port flag if the container already binds to the standard default port 8080.
Cloud Run injects the PORT environment variable (default 8080) into the container container environment.

Anahtar Kavram

Deploying containerized workloads to Cloud Run with custom service account execution identity
Bu soruyu puanla