Question

Difficulty: MediumDeploying Serverless Applications with Cloud Run and Cloud Functions

A logistics company is deploying a custom Go-based tracking service to Google Cloud Run. The containerized application inside the image listens on TCP port 80008000, and the deployment policy requires the endpoint to be publicly reachable on the web without requiring IAM authentication. Which TWO configuration options or `gcloud run deploy` command flags should be specified to achieve this outcome?

  1. Specify the `--port=8000` flag during deployment to direct Cloud Run traffic to the container's listening port.Answer
  2. Include the `--allow-unauthenticated` flag during the deployment command.Answer
  3. C
    Omit port deployment flags and hardcode the container application to ignore the `PORT` environment variable.
  4. D
    Grant the primitive `roles/owner` role to `allUsers` at the GCP project level.

Answer

The correct choices are specifying the `--port=8000` flag during deployment and including the `--allow-unauthenticated` flag in the deployment command.
To successfully deploy a container listening on port 8000 and make it publicly reachable, Cloud Run requires configuring the target port via `--port=8000` and permitting public access via `--allow-unauthenticated`.

Step-by-Step Solution

1
Configure the container ingress port binding
Passing `--port=8000` ensures Cloud Run sets the `PORT` environment variable to 8000 and routes incoming request traffic to port 8000 inside the container.
By default, Cloud Run sends traffic to port 8080 unless explicitly overridden via the `--port` flag.
2
Configure IAM access policy for public invocations
Including `--allow-unauthenticated` grants the `roles/run.invoker` permission to `allUsers`.
Cloud Run services require explicit invoker permissions to allow unauthenticated web traffic.

Key Concept

Cloud Run deployment configuration flags for custom container port binding and IAM public ingress access control.
Rate this question