Soru

Zorluk: ZorDeploying Serverless Applications with Cloud Run and Cloud Functions

An infrastructure team is deploying a containerized microservice to Google Cloud Run in the `us-central1` region using the `gcloud` CLI. The container is configured internally to listen on port `3000` rather than the default port `8080`, and the service must be restricted so that unauthenticated public requests are rejected. Which TWO flags must be included in the `gcloud run deploy` command to satisfy these operational requirements? (Select TWO.)

  1. Specify the flag --port 3000 to instruct Cloud Run to route incoming traffic to the container's listening port.Cevap
  2. Specify the flag --no-allow-unauthenticated to enforce IAM authentication on the deployed service.Cevap
  3. C
    Specify the flag --set-env-vars PORT=8080 to force the containerized application to remap port 3000 to port 8080.
  4. D
    Grant the primitive Owner role (roles/owner) to all project users to permit authenticated invocations.

Cevap

To deploy a container listening on port 3000 and block unauthenticated access, the deployment command must include both the flag to specify port 3000 and the flag to disable unauthenticated invocations.
When deploying a containerized workload to Cloud Run that listens on a non-standard port, specifying the container ingress port flag informs Cloud Run where to direct incoming HTTP traffic. Combining this with the flag to require authentication enforces least-privilege security by ensuring only authorized IAM principals can invoke the microservice.

Adım Adım Çözüm

1
Identify the ingress container port configuration flag for Cloud Run.
The flag `--port 3000` explicitly tells Cloud Run to direct HTTP requests to port 3000 on the container.
By default Cloud Run expects the container to listen on port 8080.
2
Identify the authentication control flag for Cloud Run deployment.
The flag `--no-allow-unauthenticated` removes public access and requires IAM authentication for requests.
Omitting this flag or specifying `--allow-unauthenticated` would make the service publicly accessible to the internet.

Anahtar Kavram

Deploying containerized workloads to Cloud Run with custom port configurations and IAM invocation controls.
Bu soruyu puanla