Soru

Zorluk: KolayDeploying Serverless Applications with Cloud Run and Cloud Functions

You are deploying a custom containerized HTTP web application to Google Cloud Run using the gcloud command line interface. Which TWO configurations or actions are required to ensure the service deploys successfully and receives HTTP traffic? (Select TWO.)

  1. Configure the web application inside the container to listen on the port defined by the PORT environment variable.Cevap
  2. Execute the gcloud run deploy command specifying the container image.Cevap
  3. C
    Hardcode the application inside the container to listen exclusively on port 3000 regardless of environment variables.
  4. D
    Grant the primitive Owner role to end users so they have permission to send HTTP requests to the service.

Cevap

To successfully deploy and serve HTTP traffic on Cloud Run, the containerized application must listen on the port specified by the PORT environment variable, and the service must be deployed using the gcloud run deploy command.
Cloud Run injects the PORT environment variable into the container instance context (defaulting to 8080), which the web application must bind to for successful ingress traffic handling. Deploying the application is accomplished via the standard gcloud run deploy command.

Adım Adım Çözüm

1
Ensure application code listens on the expected port variable
The application inside the container reads the PORT environment variable (default 8080) provided by the Cloud Run container runtime.
Cloud Run sends traffic to the port defined in the PORT environment variable and performs startup checks on it.
2
Deploy the container to Cloud Run using gcloud CLI
Run gcloud run deploy <service-name> --image <image-url> to create or update the Cloud Run service revision.
The gcloud run deploy command provisions the Cloud Run service and provisions an HTTP endpoint for incoming requests.

Anahtar Kavram

Cloud Run Port Binding & Deployment Syntax
Bu soruyu puanla