A cloud developer is deploying a containerized REST API microservice named orders-api to Google Cloud Run using the gcloud command-line tool. The microservice needs to accept public HTTP traffic from external clients and dynamically receive requests on the port assigned by the platform container contract. Which two configuration actions are required to ensure the microservice successfully receives and handles incoming requests on Cloud Run? Select 2 options.
- Configure the application container code to listen on the HTTP port defined by the PORT environment variable injected by Cloud Run.Cevap
- Include the --allow-unauthenticated flag when executing the gcloud run deploy command.Cevap
- CHardcode port 80 in the Dockerfile EXPOSE directive and override the PORT environment variable to 80, as Cloud Run routes traffic exclusively through port 80 inside the container.
- DGrant the primitive roles/Editor role to the default compute service account at the project level to enable public HTTP invocation.
Cevap
The microservice requires configuring the container application to listen on the port specified by the injected PORT environment variable and deploying the service with the --allow-unauthenticated flag to accept public HTTP traffic.
Cloud Run requires containers to comply with its runtime contract by listening on the port provided in the PORT environment variable. Additionally, to expose a service to public unauthenticated callers, the deployment command must pass the --allow-unauthenticated flag.
Adım Adım Çözüm
Anahtar Kavram
Cloud Run Container Contract and Ingress Authentication