Soru

Zorluk: KolayDeploying Serverless Applications with Cloud Run and Cloud Functions

A developer has packaged a microservice into a container image named `gcr.io/my-project/order-service:v1` and needs to deploy it as a fully managed serverless application on Google Cloud. The application must be deployed to the `us-central1` region and allow public unauthenticated HTTP requests. Which `gcloud` command should be used to accomplish this deployment?

  1. gcloud run deploy order-service --image gcr.io/my-project/order-service:v1 --region us-central1 --allow-unauthenticatedCevap
  2. B
    gcloud functions deploy order-service --image gcr.io/my-project/order-service:v1 --region us-central1 --allow-unauthenticated
  3. C
    gcloud run deploy order-service --image gcr.io/my-project/order-service:v1 --region us-central1 --port 80
  4. D
    gcloud run deploy order-service --image gcr.io/my-project/order-service:v1 --region us-central1 --role roles/owner

Cevap

The command `gcloud run deploy order-service --image gcr.io/my-project/order-service:v1 --region us-central1 --allow-unauthenticated` correctly deploys the container image to Cloud Run with public unauthenticated HTTP access.
To deploy a container image to Cloud Run, the `gcloud run deploy` command is used specifying the service name, the `--image` location, the `--region`, and the `--allow-unauthenticated` flag to allow public HTTP requests.

Adım Adım Çözüm

1
Identify the appropriate serverless compute product for container images
Cloud Run is the managed GCP platform for executing stateless container images listening on HTTP requests.
Cloud Run natively accepts pre-built container images from Google Container Registry (GCR) or Artifact Registry.
2
Formulate the correct gcloud CLI command and mandatory flags
Use `gcloud run deploy` with `--image`, `--region`, and `--allow-unauthenticated`.
The `--allow-unauthenticated` flag grants the `roles/run.invoker` permission to `allUsers`, enabling public access.

Anahtar Kavram

Deploying containerized applications to Cloud Run via gcloud CLI
Tahmini Süre:45s
Bu soruyu puanla