A platform engineer is deploying a containerized microservice to Google Cloud Run in the us-central1 region using the container image us-docker.pkg.dev/corp-apps/prod/account-api:v1. The application inside the container is configured to listen strictly on custom TCP port 5000 and does not automatically detect the default PORT environment variable. The requirement dictates that the service must immediately route 100% of live HTTP traffic to this newly deployed revision while enforcing private access by blocking all unauthenticated invocations. Which gcloud command must the engineer execute to achieve this deployment outcome correctly?
- gcloud run deploy account-api --image=us-docker.pkg.dev/corp-apps/prod/account-api:v1 --port=5000 --no-allow-unauthenticated --region=us-central1Answer
- Bgcloud run deploy account-api --image=us-docker.pkg.dev/corp-apps/prod/account-api:v1 --set-env-vars=PORT=5000 --allow-unauthenticated --region=us-central1
- Cgcloud run deploy account-api --image=us-docker.pkg.dev/corp-apps/prod/account-api:v1 --port=5000 --no-traffic --no-allow-unauthenticated --region=us-central1
- Dgcloud functions deploy account-api --image=us-docker.pkg.dev/corp-apps/prod/account-api:v1 --port=5000 --entry-point=main --region=us-central1
Answer
The correct option is the command executing 'gcloud run deploy account-api --image=us-docker.pkg.dev/corp-apps/prod/account-api:v1 --port=5000 --no-allow-unauthenticated --region=us-central1'.
The correct command uses the --port=5000 flag to configure Cloud Run to forward incoming requests to port 5000 inside the container, includes --no-allow-unauthenticated to enforce strict IAM access control, and allows default 100% traffic assignment to the newly deployed revision.
Step-by-Step Solution
Key Concept
Cloud Run Custom Container Port Binding and CLI Deployment Flags