A solution architect needs to deploy a web microservice stored as a container image in Artifact Registry (`us-central1-docker.pkg.dev/my-project/apps/order-api:v1`) to Google Cloud Run. The deployment must meet the following requirements:
- The service name must be `order-api`.
- It must be deployed to the `us-central1` region.
- It must pass an environment variable `DB_HOST=10.0.0.5` to the application container.
- It must allow incoming public HTTP requests without authentication.
Which `gcloud` command correctly accomplishes this deployment?
- gcloud run deploy order-api --image=us-central1-docker.pkg.dev/my-project/apps/order-api:v1 --region=us-central1 --set-env-vars=DB_HOST=10.0.0.5 --allow-unauthenticatedCevap
- Bgcloud functions deploy order-api --image=us-central1-docker.pkg.dev/my-project/apps/order-api:v1 --region=us-central1 --set-env-vars=DB_HOST=10.0.0.5 --allow-unauthenticated
- Cgcloud run deploy order-api --image=us-central1-docker.pkg.dev/my-project/apps/order-api:v1 --zone=us-central1-a --set-env-vars=DB_HOST=10.0.0.5 --allow-unauthenticated
- Dgcloud run deploy order-api --image=us-central1-docker.pkg.dev/my-project/apps/order-api:v1 --region=us-central1 --set-env-vars=DB_HOST=10.0.0.5 --no-allow-unauthenticated
Cevap
The correct command uses 'gcloud run deploy order-api' with '--image=us-central1-docker.pkg.dev/my-project/apps/order-api:v1', '--region=us-central1', '--set-env-vars=DB_HOST=10.0.0.5', and '--allow-unauthenticated'.
The command correctly uses the 'gcloud run deploy' surface to target Cloud Run, supplies the container image URL via the '--image' flag, designates the target region with '--region=us-central1', sets runtime environment variables using '--set-env-vars', and explicitly enables public HTTP ingress via '--allow-unauthenticated'.
Adım Adım Çözüm
Anahtar Kavram
Cloud Run Service Deployment CLI Syntax
Tahmini Süre:1m 35s