Soru

Zorluk: Çok zorDeploying Serverless Applications with Cloud Run and Cloud Functions

An operations engineer is deploying a stateless backend microservice to Google Cloud Run using the gcloud command-line interface. The service must accept incoming asynchronous HTTP calls from an authenticated client application while adhering to Google Cloud security and container environment standards. Which of the following configuration steps are required to ensure successful deployment and invocation of this Cloud Run service? (Select TWO options.)

  1. Configure the containerized application to listen on the HTTP port specified by the PORT environment variable, which defaults to 8080.Cevap
  2. B
    Hardcode the application inside the container image to listen exclusively on port 3000 and omit the --port flag during gcloud run deploy.
  3. Grant the predefined Cloud Run Invoker role (roles/run.invoker) to the service account or identity making requests to the service.Cevap
  4. D
    Assign the primitive Owner role (roles/owner) to the Cloud Run runtime service account to grant ingress access for incoming HTTP traffic.

Cevap

To successfully deploy and enable authenticated access to a Cloud Run service, the application must listen on the port injected by the PORT environment variable (default 8080), and the calling principal must be granted the Cloud Run Invoker role (roles/run.invoker).
Cloud Run requires containers to listen for HTTP requests on the port specified by the PORT environment variable (default 8080). Additionally, private Cloud Run services require callers to hold the predefined Cloud Run Invoker role (roles/run.invoker) to authenticate requests.

Adım Adım Çözüm

1
Configure container port binding
The web container listens on process.env.PORT or port 8080.
Cloud Run routes ingress traffic to the container port defined by the PORT environment variable (defaulting to 8080).
2
Configure access control IAM policies
The invoking principal gains execution permission via the Cloud Run Invoker role.
By default, Cloud Run services require IAM authentication, which is controlled by assigning roles/run.invoker to calling identities.

Anahtar Kavram

Cloud Run Container Port Contract and IAM Invoker Permissions
Bu soruyu puanla