Soru

Zorluk: KolayDeploying Serverless Applications with Cloud Run and Cloud Functions

A developer is deploying a stateless containerized web application to Google Cloud Run using the gcloud CLI. The application must be publicly accessible over HTTP without requiring authentication. Which TWO configuration steps or practices must be implemented to ensure the deployment succeeds and is publicly accessible? (Select TWO.)

  1. Pass the --allow-unauthenticated flag during deployment (or grant the Cloud Run Invoker role to allUsers) to permit public access.Cevap
  2. Ensure the containerized application listens for incoming HTTP requests on the port specified by the PORT environment variable.Cevap
  3. C
    Grant the primitive Owner role (roles/owner) to allUsers on the Cloud Run service resource.
  4. D
    Hardcode the application container to listen strictly on HTTPS port 443 inside the Dockerfile.

Cevap

To successfully deploy a public Cloud Run service, you must allow unauthenticated invocations by passing the --allow-unauthenticated flag (or granting roles/run.invoker to allUsers) and ensure the containerized web app listens on the port defined by the PORT environment variable.
Deploying a public Cloud Run service requires fulfilling both the container contract and IAM ingress settings: the application must listen on the port injected via the PORT environment variable (default 8080), and unauthenticated access must be enabled either with the --allow-unauthenticated deployment flag or by assigning the Cloud Run Invoker role (roles/run.invoker) to allUsers.

Adım Adım Çözüm

1
Configure the application code and Dockerfile for Cloud Run runtime requirements.
The application listens on the port specified by the PORT environment variable (default 8080).
Cloud Run automatically routes container traffic to the port defined by the PORT environment variable injected into the container environment.
2
Execute the deployment command with appropriate IAM access flags.
The service is deployed with IAM policies granting invocation privileges to unauthenticated requests.
Cloud Run services default to private (authenticated only). Specifying --allow-unauthenticated binds the roles/run.invoker role to allUsers.

Anahtar Kavram

Cloud Run Container Contract and Public Access IAM Binding
Bu soruyu puanla