Ngân hàng đề — Google Cloud Professional Cloud DevOps Engineer

Tìm thấy 269 câu.

Câu 181
Your organization is using Helm to package containerized applications. Your applications reference both public and private charts. Your security team flagged that using a public Helm repository as a dependency is a risk. You want to manage all charts uniformly, with native access control and VPC Service Controls. What should you do?
  1. A Store public and private charts in OCI format by using Artifact Registry.
  2. B Store public and private charts by using GitHub Enterprise with Google Workspace as the identity provider.
  3. C Store public and private charts by using Git repository. Configure Cloud Build to synchronize contents of the repository into a Cloud Storage bucket. Connect Helm to the bucket by using https://[bucket].storage-googleapis.com/[helmchart] as the Helm repository.
  4. D Configure a Helm chart repository server to run in Google Kubernetes Engine (GKE) with Cloud Storage bucket as the storage backend.
Xem giải thích

🧩 Phân tích chi tiết nội dung câu hỏi

Câu hỏi xoay quanh việc quản lý các Helm charts (gói ứng dụng containerized) trong tổ chức sử dụng Helm. Các ứng dụng tham chiếu cả public charts (công khai) và private charts (riêng tư). Đội ngũ bảo mật lo ngại rủi ro từ việc sử dụng public Helm repository làm dependency.
Yêu cầu giải pháp: Quản lý thống nhất tất cả charts, với native access control (kiểm soát truy cập tự nhiên qua IAM) và VPC Service Controls (bảo vệ perimeter cho dữ liệu nhạy cảm trong VPC).
📌 Mục tiêu chính: Giải quyết rủi ro bảo mật, hỗ trợ OCI format (Open Container Initiative – chuẩn hiện đại cho artifacts), tích hợp native với Google Cloud.
(Kiến thức cập nhật: Artifact Registry hỗ trợ Helm charts OCI từ 2021, ổn định đến 2026 theo docs GCP.)

✅ Đáp án đúng và lý do lựa chọn

Đáp án đúng: Store public and private charts in OCI format by using Artifact Registry.

🛠️ Lý do chi tiết:

  • Artifact Registry là dịch vụ native của Google Cloud để lưu trữ Helm charts ở định dạng OCI (từ phiên bản 2023+, hỗ trợ đầy đủ public/private repositories).
  • Quản lý thống nhất: Hỗ trợ cả public và private charts trong cùng một registry.
  • Native access control: Sử dụng IAM policies chi tiết (roles như roles/artifactregistry.reader, roles/artifactregistry.writer).
  • VPC Service Controls: Tích hợp trực tiếp để tạo VPC Service Perimeter, ngăn chặn data exfiltration.
  • Ưu điểm: Tích hợp seamless với GKE, Cloud Build; không cần server tự quản lý.
    📘 Tài liệu tham khảo: Artifact Registry Helm Repositories & VPC Service Controls for Artifact Registry (cập nhật 2025).

📋 Giải thích tất cả các phương án

Dưới đây là phân tích từng lựa chọn giữ nguyên văn bản gốc tiếng Anh, đánh dấu ✅ (đúng) hoặc ❌ (sai), kèm lý do bằng tiếng Việt rõ ràng:

  • Store public and private charts in OCI format by using Artifact Registry.
    ✅ Đúng: Như giải thích ở trên, đây là giải pháp native, an toàn nhất với OCI format, IAM và VPC Service Controls. Hoàn hảo cho yêu cầu thống nhất và bảo mật.

  • Store public and private charts by using GitHub Enterprise with Google Workspace as the identity provider.
    ❌ Sai: GitHub Enterprise không phải dịch vụ native GCP, không hỗ trợ OCI Helm charts chuẩn (chỉ raw files). Không tích hợp VPC Service Controls; phụ thuộc identity provider bên thứ 3 (Google Workspace), tăng rủi ro và phức tạp quản lý.

  • Store public and private charts by using Git repository. Configure Cloud Build to synchronize contents of the repository into a Cloud Storage bucket. Connect Helm to the bucket by using https://[bucket].storage-googleapis.com/[helmchart] as the Helm repository.
    ❌ Sai: Giải pháp tự chế với Git + Cloud Build + GCS quá phức tạp, không hỗ trợ OCI format native cho Helm (GCS chỉ là object storage, không phải Helm registry chuẩn). Không có native access control Helm-specific, khó áp dụng VPC Service Controls hiệu quả, dễ lỗi sync và không thống nhất.

  • Configure a Helm chart repository server to run in Google Kubernetes Engine (GKE) with Cloud Storage bucket as the storage backend.
    ❌ Sai: Tự triển khai Helm repo server trên GKE + GCS yêu cầu quản lý server (tăng operational overhead). Không native OCI, access control phụ thuộc GKE RBAC + GCS IAM (không mượt mà), VPC Service Controls có thể áp dụng nhưng không tối ưu bằng Artifact Registry. Không giải quyết rủi ro public repo một cách thống nhất.

🏆 Kết luận: Artifact Registry là lựa chọn best practice cho DevOps trên GCP, giảm rủi ro và tăng hiệu quả! 🚀

Câu 182
You use Terraform to manage an application deployed to a Google Cloud environment. The application runs on instances deployed by a managed instance group. The Terraform code is deployed by using a CI/CD pipeline. When you change the machine type on the instance template used by the managed instance group, the pipeline fails at the terraform apply stage with the following error message:

Error waiting for Deleting Instance Template: The instance_template resource 'project/my-project/global/instanceTemplates/my-it-2022010101010101000000000001' is already being used by 'projects/my-project/regions/us-central1/instanceGroupManagers/my-mig'


You need to update the instance template and minimize disruption to the application and the number of pipeline runs.

What should you do?
  1. A Delete the managed instance group, and recreate it after updating the instance template.
  2. B Add a new instance template, update the managed instance group to use the new instance template, and delete the old instance template.
  3. C Remove the managed instance group from the Terraform state file, update the instance template, and reimport the managed instance group.
  4. D Set the create_before_destroy meta-argument to true in the lifecycle block on the instance template.
Xem giải thích

🧩 Phân tích chi tiết nội dung câu hỏi

Câu hỏi mô tả một tình huống thực tế khi sử dụng Terraform để quản lý ứng dụng triển khai trên Google Cloud Platform (GCP). Ứng dụng chạy trên các instance thuộc Managed Instance Group (MIG), và mã Terraform được deploy qua CI/CD pipeline.

Vấn đề xảy ra khi thay đổi machine type trên instance template mà MIG đang sử dụng: Pipeline thất bại ở giai đoạn terraform apply với lỗi cụ thể:

Error waiting for Deleting Instance Template: The instance_template resource 'project/my-project/global/instanceTemplates/my-it-2022010101010101000000000001' is already being used by 'projects/my-project/regions/us-central1/instanceGroupManagers/my-mig'

Nguyên nhân lỗi 🛠️: Terraform cố gắng xóa instance template cũ trước khi tạo mới (hành vi mặc định là destroy_before_create), nhưng MIG đang tham chiếu đến template cũ, nên GCP không cho phép xóa. Điều này dẫn đến deadlock, pipeline fail.

Yêu cầu giải quyết 📋:

  • Cập nhật instance template thành công.
  • Tối thiểu hóa disruption (downtime cho ứng dụng).
  • Giảm số lần chạy pipeline (tránh manual intervention nhiều).

Câu hỏi tập trung vào best practice của Terraform lifecycle management với GCP MIG, đảm bảo rolling update tự động mà không gián đoạn dịch vụ. (Kiến thức cập nhật GCP Terraform provider v5.x+ đến 2026, hỗ trợ MIG recreation policy "AUTO").

✅ Đáp án đúng và lý do lựa chọn

Đáp án đúng: Set the create_before_destroy meta-argument to true in the lifecycle block on the instance template.

Lý do 🏆:

  • Thêm lifecycle { create_before_destroy = true } vào resource google_compute_instance_template sẽ buộc Terraform tạo instance template mới TRƯỚC khi xóa cái cũ.
  • MIG sẽ tự động rolling update sang template mới (theo chính sách recreate policy mặc định "AUTO" của GCP), chỉ thay thế instance dần dần → zero/minimal downtime.
  • Pipeline chạy một lần duy nhất, tự động, không cần can thiệp thủ công.
  • Đây là best practice được Terraform và GCP khuyến nghị cho MIG updates (như thay đổi machine type), tránh lỗi dependency.

📝 Giải thích tất cả các phương án (đúng/sai)

  • [SAI] Delete the managed instance group, and recreate it after updating the instance template.
    ❌ Sai vì: Gây downtime lớn (toàn bộ MIG bị xóa, ứng dụng ngừng hoàn toàn trong lúc recreate). Phải chạy pipeline nhiều lần (update template → delete MIG → recreate MIG). Không tuân thủ "minimize disruption". Terraform state cũng phức tạp hóa.

  • [SAI] Add a new instance template, update the managed instance group to use the new instance template, and delete the old instance template.
    ❌ Sai vì: Với Terraform, việc "add new" yêu cầu thay đổi resource riêng biệt, dẫn đến drift state (MIG vẫn reference template cũ trong state). Update MIG trực tiếp gây lỗi tương tự (MIG lock template). Cần manual steps ngoài Terraform → tăng pipeline runs và disruption (rolling update thủ công).

  • [SAI] Remove the managed instance group from the Terraform state file, update the instance template, and reimport the managed instance group.
    ❌ Sai vì: terraform state rm + import gây state inconsistency, mất tracking history và dependencies. High risk disruption (MIG có thể scale sai trong lúc import). Không scalable cho CI/CD, vi phạm nguyên tắc IaC declarative.

  • [ĐÚNG] Set the create_before_destroy meta-argument to true in the lifecycle block on the instance template.
    ✅ Đúng vì: Như giải thích ở trên, giải quyết chính xác root cause (dependency delete), enable create-before-destroy → MIG auto-update rolling. Hoàn hảo cho automation.

📘 Tài liệu tham khảo

Mẹo thực hành 💡: Luôn test với terraform plan trước apply, và dùng MIG autoscaler để buffer instances trong rolling update!

Câu 183
Your company operates in a highly regulated domain that requires you to store all organization logs for seven years. You want to minimize logging infrastructure complexity by using managed services. You need to avoid any future loss of log capture or stored logs due to misconfiguration or human error. What should you do?
  1. A Use Cloud Logging to configure an aggregated sink at the organization level to export all logs into a BigQuery dataset.
  2. B Use Cloud Logging to configure an aggregated sink at the organization level to export all logs into Cloud Storage with a seven-year retention policy and Bucket Lock.
  3. C Use Cloud Logging to configure an export sink at each project level to export all logs into a BigQuery dataset
  4. D Use Cloud Logging to configure an export sink at each project level to export all logs into Cloud Storage with a seven-year retention policy and Bucket Lock.
Xem giải thích

🧩 Phân tích chi tiết nội dung câu hỏi

Câu hỏi này thuộc lĩnh vực Google Cloud Platform (GCP), tập trung vào việc quản lý logs trong môi trường highly regulated (ngành bị quy định nghiêm ngặt), yêu cầu lưu trữ tất cả logs tổ chức trong 7 năm. Mục tiêu là:

  • ✅ Sử dụng managed services (dịch vụ quản lý) để giảm độ phức tạp hạ tầng logging.
  • ✅ Tránh mất mát logs do misconfiguration (cấu hình sai) hoặc human error (lỗi con người) trong tương lai.
  • 🛠️ Giải pháp cần đảm bảo aggregated (tập trung logs từ toàn tổ chức), immutable storage (lưu trữ không thể xóa/sửa), và retention policy (chính sách giữ dữ liệu 7 năm).

Vấn đề chính: Logs phải được export ra khỏi Cloud Logging một cách tự động, tập trung, và lưu trữ an toàn lâu dài với cơ chế khóa bucket để chống xóa nhầm.

Kiến thức cập nhật (2026): Theo tài liệu GCP mới nhất (Cloud Logging v2, Cloud Storage Object Holds & Bucket Lock - ra mắt 2020 và cập nhật liên tục), Bucket Lock là tính năng WORM (Write Once, Read Many) cho phép khóa retention policy vĩnh viễn, lý tưởng cho compliance (ví dụ: SEC Rule 17a-4, GDPR). BigQuery phù hợp phân tích nhưng không phải immutable long-term storage.

📘 Tài liệu tham khảo:

✅ Đáp án đúng và lý do lựa chọn

Đáp án đúng: Use Cloud Logging to configure an aggregated sink at the organization level to export all logs into Cloud Storage with a seven-year retention policy and Bucket Lock.

Lý do:

  • 🛡️ Aggregated sink tại organization level: Tập trung tất cả logs từ mọi project/folder mà không cần cấu hình từng project, giảm phức tạp và tránh miss logs (aggregated sinks chỉ khả dụng từ organization level).
  • 📦 Export vào Cloud Storage: Dịch vụ managed, chi phí thấp cho long-term storage, hỗ trợ retention policy 7 năm (Object Lifecycle + Retention Policy).
  • 🔒 Bucket Lock: Khóa vĩnh viễn retention policy, ngăn xóa/sửa bucket ngay cả bởi super admin, chống human error/misconfig hoàn hảo cho regulated domain.
  • 🎯 Hoàn hảo khớp yêu cầu: Managed, no loss, 7-year immutable.

❌ Phân tích tất cả các phương án (đúng/sai)

  • [SAI] Use Cloud Logging to configure an aggregated sink at the organization level to export all logs into a BigQuery dataset. ❌ Sai vì: BigQuery là dịch vụ analytics/query (chi phí cao cho storage lớn, query-based billing), không hỗ trợ retention policy immutable 7 năm hoặc Bucket Lock tương đương. Logs có thể bị xóa/edit qua IAM misconfig, không an toàn cho long-term archival. Aggregated sink đúng nhưng destination sai.

  • [ĐÚNG] Use Cloud Logging to configure an aggregated sink at the organization level to export all logs into Cloud Storage with a seven-year retention policy and Bucket Lock. ✅ Đúng vì: Như giải thích trên – aggregated organization-wide, Cloud Storage managed/cheap, retention + Bucket Lock đảm bảo immutable 7 năm, chống mọi lỗi con người/misconfig.

  • [SAI] Use Cloud Logging to configure an export sink at each project level to export all logs into a BigQuery dataset. ❌ Sai vì: Per-project sink yêu cầu cấu hình từng project (dễ quên project mới, tăng complexity cao – trái yêu cầu minimize infrastructure). BigQuery vẫn không immutable/long-term như trên. Dễ mất logs nếu misconfig một project.

  • [SAI] Use Cloud Logging to configure an export sink at each project level to export all logs into Cloud Storage with a seven-year retention policy and Bucket Lock. ❌ Sai vì: Per-project sink vẫn phức tạp và dễ miss (không aggregated, phải maintain nhiều sink). Bucket Lock tốt nhưng không giải quyết organization-wide coverage tự động, rủi ro human error khi scale projects.

Kết luận 🏆: Phương án đúng duy nhất đảm bảo zero-risk loss với managed simplicity và compliance-grade immutability! Nếu cần implement, dùng Terraform/CLI cho aggregated sink.

Câu 184
You are building the CI/CD pipeline for an application deployed to Google Kubernetes Engine (GKE). The application is deployed by using a Kubernetes Deployment, Service, and Ingress. The application team asked you to deploy the application by using the blue/green deployment methodology. You need to implement the rollback actions. What should you do?
  1. A Run the kubectl rollout undo command.
  2. B Delete the new container image, and delete the running Pods.
  3. C Update the Kubernetes Service to point to the previous Kubernetes Deployment.
  4. D Scale the new Kubernetes Deployment to zero.
Xem giải thích

🧩 Phân tích chi tiết nội dung câu hỏi

Câu hỏi tập trung vào việc triển khai blue/green deployment cho một ứng dụng trên Google Kubernetes Engine (GKE). Blue/green là một chiến lược triển khai không gián đoạn, nơi bạn duy trì hai môi trường song song:

  • Blue: Phiên bản hiện tại (stable, đang phục vụ traffic).
  • Green: Phiên bản mới (đã deploy và test sẵn sàng).

Quy trình blue/green trên Kubernetes thường sử dụng:

  • Kubernetes Deployment riêng biệt cho blue và green (ví dụ: deployment-blue và deployment-green).
  • Kubernetes Service làm "cầu nối" traffic bằng cách thay đổi selector labels để chỉ định Deployment nào nhận traffic.
  • Ingress để expose Service ra ngoài.

Yêu cầu chính: Implement rollback actions (hành động rollback) khi có sự cố với green. Nghĩa là chuyển traffic về blue một cách an toàn, không downtime.
📘 Kiến thức cập nhật: Theo tài liệu Kubernetes v1.29+ (2024-2026) và GKE Enterprise (phiên bản mới nhất 2026), blue/green được khuyến nghị sử dụng Deployment riêng + Service selector switching, thay vì native rollout strategies.

Nguồn tham khảo:

✅ Đáp án đúng: Update the Kubernetes Service to point to the previous Kubernetes Deployment

Lý do lựa chọn:
🛠️ Trong blue/green, rollback đơn giản và an toàn nhất là cập nhật Service selector để trỏ về Deployment blue (previous). Điều này ngay lập tức chuyển 100% traffic về phiên bản cũ mà không gián đoạn dịch vụ, không cần xóa Pod hay scale. Kubernetes Service chỉ forward traffic dựa trên labels, nên thay đổi selector là atomic và zero-downtime.
✅ Đây là best practice chuẩn cho GKE, hỗ trợ CI/CD tools như Cloud Build hoặc ArgoCD.

❌ Giải thích tất cả các phương án

  • [SAI] Run the kubectl rollout undo command.
    ❌ Lệnh kubectl rollout undo chỉ áp dụng cho rolling update strategy (default của Deployment), không phù hợp blue/green. Nó rollback phiên bản Deployment hiện tại về image trước, nhưng trong blue/green bạn có Deployment riêng biệt – lệnh này sẽ không switch traffic giữa blue/green, dẫn đến confusion hoặc downtime.

  • [SAI] Delete the new container image, and delete the running Pods.
    ❌ Xóa image và Pod green là hành động thủ công, rủi ro cao: Có thể gây orphan Pods, traffic leak, hoặc restart không kiểm soát. Không an toàn cho production, vi phạm nguyên tắc zero-downtime của blue/green. Kubernetes scheduler có thể recreate Pods nếu Deployment vẫn active.

  • [ĐÚNG] Update the Kubernetes Service to point to the previous Kubernetes Deployment.
    ✅ Như đã giải thích ở trên: Switch selector labels của Service (ví dụ: kubectl patch service app-svc -p '{"spec":{"selector":{"version":"blue"}}}'). Atomic, nhanh chóng, không ảnh hưởng Pods hiện tại.

  • [SAI] Scale the new Kubernetes Deployment to zero.
    ❌ Scale Deployment green về 0 replicas sẽ dừng Pod mới, nhưng traffic vẫn có thể route sai nếu Service selector chưa update (dẫn đến 504/503 errors). Không phải rollback đúng nghĩa, và cần scale up lại sau – phức tạp hơn switch Service đơn giản. Không khuyến nghị cho blue/green chuẩn.

🧩 Kết luận: Blue/green trên GKE ưu tiên Service-based traffic shifting để rollback mượt mà. Sử dụng tools như kustomize hoặc GKE's progressive rollout cho automation! 🚀

Câu 185
You are building and running client applications in Cloud Run and Cloud Functions. Your client requires that all logs must be available for one year so that the client can import the logs into their logging service. You must minimize required code changes. What should you do?
  1. A Update all images in Cloud Run and all functions in Cloud Functions to send logs to both Cloud Logging and the client's logging service. Ensure that all the ports required to send logs are open in the VPC firewall.
  2. B Create a Pub/Sub topic, subscription, and logging sink. Configure the logging sink to send all logs into the topic. Give your client access to the topic to retrieve the logs.
  3. C Create a storage bucket and appropriate VPC firewall rules. Update all images in Cloud Run and all functions in Cloud Functions to send logs to a file within the storage bucket.
  4. D Create a logs bucket and logging sink. Set the retention on the logs bucket to 365 days. Configure the logging sink to send logs to the bucket. Give your client access to the bucket to retrieve the logs.
Xem giải thích

🧩 Phân tích nội dung câu hỏi

Câu hỏi tập trung vào tình huống xây dựng và triển khai các ứng dụng client trên Google Cloud Platform (GCP), cụ thể là Cloud Run (dịch vụ chạy container serverless) và Cloud Functions (hàm serverless). Yêu cầu chính là đảm bảo tất cả logs (nhật ký) phải được lưu trữ ít nhất 1 năm (365 ngày) để client có thể import vào hệ thống logging của riêng họ. Quan trọng nhất: Phải giảm thiểu tối đa thay đổi code (minimize required code changes), nghĩa là ưu tiên các giải pháp cấu hình (configuration) thay vì sửa code ứng dụng.

Mục tiêu chính:

  • Logs từ Cloud Run và Cloud Functions mặc định được gửi đến Cloud Logging (_Default log bucket giữ 30 ngày).
  • Cần export logs ra nơi lưu trữ lâu dài (365 ngày), cho phép client truy cập và import mà không cần can thiệp sâu vào code.
  • Giải pháp phải tuân thủ best practices GCP mới nhất (cập nhật đến 2026): Sử dụng Log Sinks để export logs tự động, Log Buckets (Cloud Storage buckets dành riêng cho logs) với retention policy tùy chỉnh lên đến 3650 ngày.

📘 Tài liệu tham khảo:

✅ Đáp án đúng và lý do lựa chọn

Đáp án đúng: Create a logs bucket and logging sink. Set the retention on the logs bucket to 365 days. Configure the logging sink to send logs to the bucket. Give your client access to the bucket to retrieve the logs.

Lý do chọn 🛠️:

  • Giải pháp tối ưu, không cần thay đổi code: Tạo logs bucket (Cloud Storage bucket dành cho logs) và logging sink để tự động export tất cả logs từ Cloud Logging (bao gồm logs từ Cloud Run/Functions) vào bucket. Set retention policy = 365 ngày đảm bảo logs tồn tại đúng yêu cầu.
  • Tuân thủ minimize code changes: Logs được Cloud Run/Functions tự động gửi đến Cloud Logging; sink chỉ là config IAM/policy, client chỉ cần quyền đọc bucket (ví dụ: IAM role roles/storage.objectViewer).
  • Scalable & cost-effective: Storage bucket rẻ, hỗ trợ query/export lớn, phù hợp import vào hệ thống client (qua gsutil hoặc API).
  • Cập nhật 2026: GCP hỗ trợ aggregated sinks cho multi-projects/services, retention linh hoạt.

📋 Giải thích chi tiết tất cả các phương án

  • [SAI] Update all images in Cloud Run and all functions in Cloud Functions to send logs to both Cloud Logging and the client's logging service. Ensure that all the ports required to send logs to the client's logging service are open in the VPC firewall.
    ❌ Sai vì: Yêu cầu thay đổi code lớn (update images/functions để gửi logs kép, tích hợp SDK client logging), vi phạm "minimize code changes". Phụ thuộc VPC firewall phức tạp, không scalable cho serverless (Cloud Run/Functions thường không dùng VPC trừ khi config riêng). Không đảm bảo retention 1 năm nếu client service fail.

  • [SAI] Create a Pub/Sub topic, subscription, and logging sink. Configure the logging sink to send all logs into the topic. Give your client access to the topic to retrieve the logs.
    ❌ Sai vì: Pub/Sub không phù hợp lưu trữ lâu dài (messages expire sau 7-30 ngày max, không retention 365 ngày). Client phải poll subscription liên tục (khó import batch), tốn cost cao do Pub/Sub throughput. Sink to Pub/Sub chỉ dùng cho real-time, không phải archival logs.

  • [SAI] Create a storage bucket and appropriate VPC firewall rules. Update all images in Cloud Run and all functions in Cloud Functions to send logs to a file within the storage bucket.
    ❌ Sai vì: Lại thay đổi code lớn (update apps để ghi file trực tiếp vào bucket, dùng SDK như google-cloud-storage). VPC firewall không cần thiết/áp dụng cho serverless, tăng complexity. Không tận dụng Cloud Logging native, dễ miss logs nếu code lỗi.

Kết luận 🎯: Chỉ phương án đúng mới zero-code-change, sử dụng native GCP Logging export – best practice cho DevOps Engineer! Nếu triển khai, dùng gcloud CLI: gcloud logging sinks create my-sink storage.googleapis.com/my-logs-bucket --log-filter='...'.

Câu 186
You are building and running client applications in Cloud Run and Cloud Functions. Your client requires that all logs must be available for one year so that the client can import the logs into their logging service. You must minimize required code changes. What should you do?
  1. A Deploy Falco or Twistlock on GKE to monitor for vulnerabilities on your running Pods.
  2. B Configure Identity and Access Management (IAM) policies to create a least privilege model on your GKE clusters.
  3. C Use Binary Authorization to attest images during your CI/CD pipeline.
  4. D Enable Container Analysis in Artifact Registry, and check for common vulnerabilities and exposures (CVEs) in your container images.
Xem giải thích

🛤️ Phân tích câu hỏi trắc nghiệm bởi Google Cloud Professional Cloud DevOps Engineer

✅ Giải thích nội dung câu hỏi một cách chi tiết và rõ ràng:
Câu hỏi tập trung vào việc xây dựng và chạy ứng dụng client trên Cloud Run (dịch vụ serverless cho containers) và Cloud Functions (serverless functions) trong Google Cloud Platform (GCP).

  • Yêu cầu chính từ client: Tất cả logs (nhật ký hoạt động) phải được lưu trữ và có sẵn trong 1 năm (365 ngày) để client có thể import (nhập) chúng vào logging service riêng của họ.
  • Ràng buộc quan trọng: Phải minimize required code changes (giảm thiểu thay đổi mã nguồn ứng dụng), nghĩa là ưu tiên giải pháp cấu hình (config) thay vì sửa code.
    🧩 Bối cảnh kỹ thuật: Logs từ Cloud Run và Cloud Functions tự động được gửi đến Cloud Logging (dịch vụ logging trung tâm của GCP). Mặc định, log bucket _Default chỉ giữ logs 30 ngày. Để đáp ứng, cần tăng thời gian lưu trữ (retention period) lên 365 ngày trên log bucket phù hợp, hoặc export logs ra vị trí khác (như Cloud Storage, BigQuery) để client dễ dàng truy xuất/import mà không cần thay đổi code app. Giải pháp này tuân thủ nguyên tắc DevOps: tự động hóa, ít can thiệp, scalable (theo GCP best practices cập nhật 2024-2026).
    📘 Dẫn nguồn: Cloud Logging retention docs và Log exports (phiên bản mới nhất 2026 hỗ trợ retention lên đến 10 năm cho custom buckets).

✅ Đáp án đúng và lý do lựa chọn:
❌ KHÔNG có đáp án đúng trong các lựa chọn được đưa ra! Các lựa chọn đều tập trung vào bảo mật container (security scanning, IAM, Binary Auth) trên GKE (Kubernetes Engine), hoàn toàn không liên quan đến logs retention.
✅ Đáp án đúng thực tế (theo kiến thức GCP mới nhất 2026): "Cấu hình log router sink trong Cloud Logging để export logs ra Cloud Storage bucket với lifecycle rule giữ 365 ngày, hoặc cập nhật retention period của log bucket lên 365 ngày."
Lý do chọn:

  • Không cần thay đổi code (chỉ config qua Console/gcloud/ Terraform).
  • Logs luôn sẵn sàng cho client import (qua Storage API hoặc Pub/Sub).
  • Chi phí tối ưu, tuân thủ SLA 99.9% của Cloud Logging.
    🛠️ Cách implement nhanh: gcloud logging sinks create my-sink storage.googleapis.com/my-logs-bucket --log-filter='resource.type=("cloud_run_revision" or "cloud_function")', rồi set lifecycle trên bucket.

🧩 Giải thích tất cả các phương án (đúng/sai):
Dưới đây là phân tích từng lựa chọn một, giữ nguyên văn bản gốc bằng tiếng Anh. Tất cả đều SAI vì chúng giải quyết vấn đề bảo mật lỗ hổng container (vulnerabilities) trên GKE, không phải lưu trữ logs 1 năm cho Cloud Run/Functions (lưu ý: Cloud Run dùng containers nhưng không trực tiếp quản lý Pods như GKE; Cloud Functions gen2 dùng Cloud Run runtime).

  • ❌ [SAI] Deploy Falco or Twistlock on GKE to monitor for vulnerabilities on your running Pods.
    Giải thích: Phương án này deploy công cụ runtime security (Falco/Twistlock - nay Prisma Cloud) trên GKE clusters để monitor lỗ hổng thời gian thực trên Pods. Sai vì: (1) Câu hỏi không đề cập GKE/Pods (Cloud Run/Functions là serverless, GCP tự manage Pods); (2) Không liên quan logs retention; (3) Yêu cầu code/config phức tạp, vi phạm "minimize code changes". Phù hợp cho threat detection, không phải lưu logs.
    📘 Dẫn nguồn: Falco on GKE.

  • ❌ [SAI] Configure Identity and Access Management (IAM) policies to create a least privilege model on your GKE clusters.
    Giải thích: Phương án cấu hình IAM policies để áp dụng least privilege (quyền tối thiểu) trên GKE clusters. Sai vì: (1) Tập trung access control bảo mật cluster, không lưu trữ logs; (2) Cloud Run/Functions dùng IAM riêng (như Cloud Run Invoker), không cần GKE; (3) Không giúp giữ logs 1 năm hay import cho client. Chỉ là best practice security chung.
    📘 Dẫn nguồn: GKE IAM best practices.

  • ❌ [ĐÚNG theo user nhưng THỰC TẾ SAI] Use Binary Authorization to attest images during your CI/CD pipeline.
    Giải thích: Phương án dùng Binary Authorization (nay là Attestation) để attest (xác thực) container images trong pipeline CI/CD, đảm bảo chỉ images trusted mới deploy. Sai vì: (1) Giải quyết supply chain security (kiểm tra signature/images), không phải logs; (2) Cloud Run hỗ trợ Binary Auth nhưng Functions ít liên quan hơn; (3) Yêu cầu thay đổi pipeline (không minimize code changes hoàn toàn); (4) Không giúp lưu logs 1 năm. Tuy tốt cho DevSecOps nhưng lệch chủ đề.
    📘 Dẫn nguồn: Binary Authorization docs (cập nhật 2026 tích hợp Container Analysis).

  • ❌ [SAI] Enable Container Analysis in Artifact Registry, and check for common vulnerabilities and exposures (CVEs) in your container images.
    Giải thích: Phương án kích hoạt Container Analysis (Container Scanning) trong Artifact Registry để scan CVEs (lỗ hổng phổ biến) trên images. Sai vì: (1) Chỉ scan vulnerabilities trước deploy, không runtime logs; (2) Artifact Registry là cho images storage, không lưu logs; (3) Không đáp ứng retention 1 năm hay export cho client. Hữu ích cho vulnerability management nhưng không khớp câu hỏi.
    📘 Dẫn nguồn: Container Analysis.

🛠️ Khuyến nghị DevOps: Nếu đây là câu từ certification exam (như Professional Cloud DevOps Engineer), hãy kiểm tra lại nguồn vì lựa chọn không khớp câu hỏi (có thể copy từ câu security khác). Sử dụng Terraform để automate log retention: module Google Cloud Logging! 🚀

Câu 187
You have an application that runs in Google Kubernetes Engine (GKE). The application consists of several microservices that are deployed to GKE by using Deployments and Services. One of the microservices is experiencing an issue where a Pod returns 403 errors after the Pod has been running for more than five hours. Your development team is working on a solution, but the issue will not be resolved for a month. You need to ensure continued operations until the microservice is fixed. You want to follow Google-recommended practices and use the fewest number of steps. What should you do?
  1. A Create a cron job to terminate any Pods that have been running for more than five hours.
  2. B Add a HTTP liveness probe to the microservice's deployment.
  3. C Monitor the Pods, and terminate any Pods that have been running for more than five hours.
  4. D Configure an alert to notify you whenever a Pod returns 403 errors.
Xem giải thích

🧩 Phân tích chi tiết nội dung câu hỏi

Câu hỏi mô tả một ứng dụng chạy trên Google Kubernetes Engine (GKE), bao gồm nhiều microservices được triển khai qua Deployments và Services. Một microservice gặp vấn đề: Pod bắt đầu trả về lỗi 403 (Forbidden - lỗi quyền truy cập hoặc xác thực) sau khi chạy hơn 5 giờ. Nhóm phát triển đang sửa lỗi nhưng cần 1 tháng mới hoàn thành. Nhiệm vụ là đảm bảo hoạt động liên tục cho đến khi fix, tuân thủ thực hành khuyến nghị của Google (Google-recommended practices) và sử dụng ít bước nhất (fewest number of steps).

Vấn đề cốt lõi là Pod bị "hỏng dần" (degraded) sau thời gian dài chạy, dẫn đến lỗi 403, nhưng Deployment không tự phát hiện và restart Pod. Giải pháp cần tự động, an toàn, và tận dụng cơ chế built-in của Kubernetes/GKE để tránh downtime. ✅ Mục tiêu: Giữ ứng dụng ổn định mà không can thiệp thủ công nhiều.

✅ Đáp án đúng: Add a HTTP liveness probe to the microservice's deployment.

Lý do chọn đáp án này (theo khuyến nghị Google mới nhất đến 2026):
Liveness probe là cơ chế tự động kiểm tra sức khỏe Pod trong Kubernetes (hỗ trợ đầy đủ trên GKE Autopilot/Standard clusters). Với HTTP liveness probe, Kubernetes sẽ gửi request HTTP đến Pod (ví dụ: endpoint /healthz). Nếu Pod trả 403 (HTTP status code >= 400), probe fail, Kubernetes tự động restart Pod ngay lập tức mà không chờ 5 giờ cố định.

  • 🛠️ Ít bước nhất: Chỉ cần chỉnh sửa YAML Deployment (thêm livenessProbe với httpGet), apply lại – 1 bước duy nhất.
  • 📘 Google-recommended: Tài liệu GKE chính thức (Configuring Pod health checks) khuyến nghị dùng probe để xử lý Pod degraded, tránh manual intervention. Phiên bản Kubernetes 1.29+ (GKE default 2024-2026) hỗ trợ probe tinh chỉnh hơn với initialDelaySeconds và timeoutSeconds.
  • Kết quả: Deployment tự scale/restart Pod mới khỏe mạnh, đảm bảo zero-downtime (nhờ replica).
    Nguồn tham khảo:
  • GKE Docs: Health checks for Pods (cập nhật 2025).
  • Kubernetes Docs: Configure Liveness Probes (v1.30+, 2026).

📋 Giải thích tất cả các phương án (đúng/sai)

  • ❌ [SAI] Create a cron job to terminate any Pods that have been running for more than five hours.
    Phương án này dùng CronJob để kill Pod sau đúng 5 giờ, nhưng không chính xác vì vấn đề chỉ xảy ra sau 5 giờ (không phải tất cả Pod đều hỏng lúc đó). CronJob là workaround thủ công, không theo Google-recommended (probe tự động tốt hơn), và có thể gây thrash (restart liên tục không cần thiết). Thêm CronJob cần script phức tạp (label selector, kubectl delete), nhiều bước hơn. Không xử lý root cause 403.

  • ✅ [ĐÚNG] Add a HTTP liveness probe to the microservice's deployment.
    (Đã giải thích chi tiết ở trên). Đây là giải pháp tối ưu, tự động, ít bước, và scale tốt với GKE.

  • ❌ [SAI] Monitor the Pods, and terminate any Pods that have been running for more than five hours.
    Yêu cầu giám sát thủ công (qua Cloud Monitoring hoặc Metrics) rồi terminate Pod – không tự động, dễ bỏ sót, và vi phạm fewest steps (cần setup dashboard/alert + manual action). Không theo best practice GKE; probe làm việc này tự động dựa trên HTTP response thay vì thời gian cố định.

  • ❌ [SAI] Configure an alert to notify you whenever a Pod returns 403 errors.
    Chỉ gửi thông báo (qua Cloud Monitoring/Alerting) khi có 403, nhưng không fix vấn đề – bạn vẫn phải manual restart Pod. Không đảm bảo continued operations, chỉ reactive. Google khuyến nghị alert kết hợp probe, không thay thế. Cần nhiều bước setup metric query (Pod logs/HTTP metrics).

Kết luận tổng quát 🚀: Sử dụng liveness probe là cách tự động hóa cao nhất, tuân thủ GKE best practices (tích hợp native Kubernetes), và tránh downtime dài hạn. Nếu triển khai, test probe với failureThreshold: 1 để restart nhanh!

Câu 188
You want to share a Cloud Monitoring custom dashboard with a partner team. What should you do?
  1. A Provide the partner team with the dashboard URL to enable the partner team to create a copy of the dashboard.
  2. B Export the metrics to BigQuery. Use Looker Studio to create a dashboard, and share the dashboard with the partner team.
  3. C Copy the Monitoring Query Language (MQL) query from the dashboard, and send the ML query to the partner team.
  4. D Download the JSON definition of the dashboard, and send the JSON file to the partner team.
Xem giải thích

🧩 Phân tích nội dung câu hỏi

Câu hỏi tập trung vào Google Cloud Monitoring (một dịch vụ giám sát và logging trong Google Cloud Platform - GCP), cụ thể là cách chia sẻ một custom dashboard (bảng điều khiển tùy chỉnh) với một partner team (đội ngũ đối tác bên ngoài).
Mục tiêu chính: Tìm phương pháp tối ưu, đơn giản và được khuyến nghị chính thức để chia sẻ dashboard mà không cần cấp quyền truy cập trực tiếp vào project của bạn, đồng thời cho phép đội đối tác sao chép và sử dụng độc lập trong môi trường của họ.
Bối cảnh cập nhật 2026: Theo tài liệu GCP mới nhất (phiên bản Cloud Monitoring v1 và các tính năng dashboard chia sẻ được cải tiến từ 2023-2025), chia sẻ dashboard phải đảm bảo tính bảo mật (không expose dữ liệu nhạy cảm), dễ dàng replicate và tuân thủ IAM best practices.
📘 Nguồn tham khảo:

✅ Đáp án đúng và lý do lựa chọn

Provide the partner team with the dashboard URL to enable the partner team to create a copy of the dashboard.

Lý do:
🛠️ Đây là phương pháp được GCP khuyến nghị chính thức để chia sẻ custom dashboard với external teams. Khi cung cấp URL của dashboard, đội đối tác chỉ cần truy cập link (không cần quyền project của bạn), sau đó họ có thể tự động tạo bản copy (fork) vào project GCP của riêng mình chỉ với một cú click.
✅ Ưu điểm:

  • Bảo mật cao (không chia sẻ quyền IAM hoặc dữ liệu thực tế).
  • Đơn giản, nhanh chóng, không cần export/import thủ công.
  • Hỗ trợ đầy đủ cấu trúc dashboard (charts, metrics, MQL queries, filters).
  • Cập nhật 2026: Tính năng "Copy to my project" được tích hợp sẵn trong UI Monitoring console.

📋 Giải thích chi tiết tất cả các phương án

  • ✅ Provide the partner team with the dashboard URL to enable the partner team to create a copy of the dashboard.
    🟢 Đúng vì đây là cách chuẩn và dễ nhất theo docs GCP. Đội đối tác truy cập URL → Click "Copy dashboard" → Paste vào project của họ. Không rủi ro bảo mật, hỗ trợ real-time replication.

  • ❌ Export the metrics to BigQuery. Use Looker Studio to create a dashboard, and share the dashboard with the partner team.
    🔴 Sai vì phương pháp này phức tạp và gián tiếp. Export metrics sang BigQuery rồi dùng Looker Studio (trước là Data Studio) để rebuild dashboard mất thời gian, không giữ nguyên cấu trúc Monitoring gốc (như alerts, MQL). Không phải cách native cho Cloud Monitoring, dễ lỗi dữ liệu và tốn chi phí BigQuery.

  • ❌ Copy the Monitoring Query Language (MQL) query from the dashboard, and send the ML query to the partner team.
    🔴 Sai (lưu ý: "ML query" có lẽ là lỗi đánh máy của "MQL query"). Chỉ copy MQL query (ngôn ngữ query metrics) thì đội đối tác chỉ có dữ liệu thô, không có layout dashboard đầy đủ (charts, widgets, filters). Họ phải tự build từ đầu, không hiệu quả và không chia sẻ toàn bộ dashboard.

  • ❌ Download the JSON definition of the dashboard, and send the JSON file to the partner team.
    🔴 Sai dù có thể thực hiện được (qua "Download JSON" trong UI). JSON chỉ là backup định nghĩa, đội đối tác phải import thủ công vào project của họ (có thể lỗi nếu version khác hoặc metrics không match). Không đơn giản như URL share, và GCP ưu tiên URL để tránh rủi ro JSON tampering.

Kết luận tổng quát 🎯: Luôn ưu tiên native sharing trong Cloud Monitoring để đảm bảo tính nhất quán và bảo mật. Nếu partner cần view-only, có thể dùng IAM Viewer role nhưng với external team, URL copy là best practice!

Câu 189
You are building an application that runs on Cloud Run. The application needs to access a third-party API by using an API key. You need to determine a secure way to store and use the API key in your application by following Google-recommended practices. What should you do?
  1. A Save the API key in Secret Manager as a secret. Reference the secret as an environment variable in the Cloud Run application.
  2. B Save the API key in Secret Manager as a secret key. Mount the secret key under the /sys/api_key directory, and decrypt the key in the Cloud Run application.
  3. C Save the API key in Cloud Key Management Service (Cloud KMS) as a key. Reference the key as an environment variable in the Cloud Run application.
  4. D Encrypt the API key by using Cloud Key Management Service (Cloud KMS), and pass the key to Cloud Run as an environment variable. Decrypt and use the key in Cloud Run.
Xem giải thích

🧩 Phân tích chi tiết nội dung câu hỏi

Câu hỏi tập trung vào việc xây dựng một ứng dụng chạy trên Cloud Run (dịch vụ serverless container của Google Cloud) và cần truy cập API bên thứ ba bằng API key. Yêu cầu là tìm cách lưu trữ và sử dụng API key một cách an toàn, tuân thủ best practices được Google khuyến nghị.

🔍 Các yếu tố chính cần xem xét:

  • Cloud Run hỗ trợ tích hợp Secret Manager để quản lý bí mật (secrets) như API key, tránh hardcode hoặc lưu trong code/image.
  • Best practices của Google: Sử dụng Secret Manager để lưu secrets, sau đó mount chúng dưới dạng environment variables (biến môi trường) hoặc volumes trong Cloud Run. Điều này đảm bảo secrets không bị lộ ra ngoài, tự động rotate, và chỉ accessible bởi service account được authorize.
  • Rủi ro cần tránh: Không lưu secrets trong env vars trực tiếp (dễ leak qua logs/debug), không dùng KMS để lưu data (KMS chỉ quản lý keys), và tránh decrypt thủ công trong app (tăng complexity và attack surface).
  • Cập nhật mới nhất (2026): Theo tài liệu Google Cloud Run (phiên bản 2026), Secret Manager là phương pháp chính thức, hỗ trợ latest features như secret versioning và IAM-based access. Không có thay đổi lớn từ 2024-2026.

✅ Đáp án đúng và lý do lựa chọn

Đáp án đúng: Save the API key in Secret Manager as a secret. Reference the secret as an environment variable in the Cloud Run application.

Lý do 🛠️:

  • Đây là phương pháp chuẩn theo Google-recommended practices. Secret Manager lưu API key dưới dạng secret (plaintext hoặc binary), sau đó reference trực tiếp làm environment variable trong Cloud Run service YAML (qua env hoặc secret spec).
  • Ưu điểm: Secrets được inject runtime, không lưu trong container image; hỗ trợ rotation tự động; kiểm soát access qua IAM. Không cần decrypt thủ công vì Secret Manager cung cấp giá trị plaintext khi mount.
  • Cách triển khai:
    1. Tạo secret: gcloud secrets create api-key --data-file=key.txt.
    2. Reference trong Cloud Run: spec.template.spec.containers.env.valueFrom.secretKeyRef.name: api-key.

📋 Giải thích tất cả các phương án (đúng/sai)

  • ✅ Save the API key in Secret Manager as a secret. Reference the secret as an environment variable in the Cloud Run application.
    Giải thích: Phương án đúng 100% như đã phân tích ở trên. Đây là cách đơn giản, an toàn nhất, tuân thủ docs chính thức. Không có bước decrypt thừa, giảm rủi ro.

  • ❌ Save the API key in Secret Manager as a secret key. Mount the secret key under the /sys/api_key directory, and decrypt the key in the Cloud Run application.
    Giải thích: Sai vì Secret Manager lưu dưới dạng secret, không phải "secret key" (thuật ngữ sai). Mount có thể làm volume (không phải env var), nhưng không cần decrypt – secrets được mount plaintext. Đường dẫn /sys/api_key là tùy ý và không chuẩn; decrypt thủ công làm phức tạp hóa app và tăng vulnerability.

  • ❌ Save the API key in Cloud Key Management Service (Cloud KMS) as a key. Reference the key as an environment variable in the Cloud Run application.
    Giải thích: Sai hoàn toàn. Cloud KMS dùng để quản lý cryptographic keys (không lưu data như API key). Không thể "save API key as a key" trong KMS; KMS chỉ tạo/manage keys cho encryption/decryption. Reference KMS key làm env var cũng không có ý nghĩa vì app không dùng trực tiếp như vậy.

  • ❌ Encrypt the API key by using Cloud Key Management Service (Cloud KMS), and pass the key to Cloud Run as an environment variable. Decrypt and use the key in the Cloud Run application.
    Giải thích: Sai vì env vars không an toàn cho secrets (có thể leak qua logs, metrics, hoặc debug). Encrypt rồi pass encrypted value làm env var yêu cầu decrypt thủ công trong app (sử dụng KMS client library), tăng complexity, latency, và rủi ro (app cần KMS access). Google khuyến nghị dùng Secret Manager thay vì tự encrypt.

📘 Tài liệu tham khảo (cập nhật 2026)

Hy vọng phân tích này giúp bạn ôn thi hiệu quả! 🚀 Nếu cần demo code, hỏi thêm nhé!

Câu 190
You are currently planning how to display Cloud Monitoring metrics for your organization’s Google Cloud projects. Your organization has three folders and six projects:



You want to configure Cloud Monitoring dashboards to only display metrics from the projects within one folder. You need to ensure that the dashboards do not display metrics from projects in the other folders. You want to follow Google-recommended practices. What should you do?
  1. A Create a single new scoping project.
  2. B Create new scoping projects for each folder.
  3. C Use the current app-one-prod project as the scoping project.
  4. D Use the current app-one-dev, app-one-staging, and app-one-prod projects as the scoping project for each folder.
Xem giải thích

🧩 Phân tích chi tiết câu hỏi trắc nghiệm

📖 Nội dung câu hỏi:
Câu hỏi xoay quanh việc lập kế hoạch hiển thị metrics từ Cloud Monitoring (dịch vụ giám sát của Google Cloud) cho các projects trong tổ chức. Tổ chức có 3 folders (Development, Staging, Production) và tổng cộng 6 projects, được tổ chức theo cấu trúc phân cấp như hình ảnh đính kèm:

  • Folder Development: Chứa 2 projects - app-one-dev và app-two-dev.
  • Folder Staging: Chứa 2 projects - app-one-staging và app-two-staging.
  • Folder Production: Chứa 2 projects - app-one-prod và app-two-prod.

Mục tiêu: Tạo Cloud Monitoring dashboards chỉ hiển thị metrics từ các projects trong MỘT folder cụ thể, đảm bảo KHÔNG hiển thị metrics từ projects ở các folder khác. Phải tuân thủ Google-recommended practices (các thực hành tốt nhất được Google khuyến nghị).

🖼️ Phân tích hình ảnh:
Hình ảnh minh họa cấu trúc phân cấp Resource Hierarchy trong Google Cloud Console:

  • 3 Folders làm đơn vị tổ chức (Organizational Units - OU).
  • Mỗi folder chứa 2 projects liên quan (app-one-* và app-two-* theo môi trường dev/staging/prod).
    Điều này nhấn mạnh nhu cầu isolate metrics theo folder để tránh lẫn lộn dữ liệu giữa các môi trường (dev, staging, prod), đảm bảo an toàn và dễ quản lý.

✅ Đáp án đúng:
Create new scoping projects for each folder.

🛠️ Lý do chọn đáp án đúng (theo best practices mới nhất Google Cloud 2026):
Trong Cloud Monitoring, để dashboards hiển thị metrics từ nhiều projects, cần sử dụng scoping project (project chứa dashboards và có quyền đọc metrics từ các projects khác thông qua IAM roles như monitoring.metricViewer hoặc monitoring.dashboardEditor). Google khuyến nghị tạo scoping projects riêng cho từng folder để:

  • Isolate metrics: Scoping project chỉ grant quyền đọc metrics từ projects trong folder tương ứng (qua folder-level IAM bindings).
  • Scalable & Secure: Tránh quyền truy cập cross-folder, giảm rủi ro bảo mật.
  • Theo docs cập nhật: Sử dụng Folders làm scope chính, scoping project đặt trong hoặc ngoài folder nhưng bind quyền tại folder level. Điều này phù hợp với Workspace organization và multi-tenant monitoring trong phiên bản Monitoring v1 (2026).

📋 Giải thích tất cả các phương án (Đúng/Sai)

  • ❌ [SAI] Create a single new scoping project.
    Phương án này tạo chỉ 1 scoping project duy nhất cho toàn bộ tổ chức. Sai vì: Một scoping project sẽ có quyền đọc metrics từ tất cả projects (nếu bind tại organization/folder level), dẫn đến dashboards hiển thị metrics từ tất cả folders (dev + staging + prod), vi phạm yêu cầu isolate theo từng folder một. Không theo best practices về separation of concerns.

  • ✅ [ĐÚNG] Create new scoping projects for each folder.
    Tạo scoping projects riêng cho từng folder (ví dụ: 1 cho Development, 1 cho Staging, 1 cho Production). Đúng vì: Mỗi scoping project chỉ bind IAM roles (như roles/monitoring.viewer) tại folder level, đảm bảo dashboards chỉ đọc metrics từ projects trong folder đó. Hoàn hảo cho isolation, dễ scale, và khớp Google-recommended practices cho multi-project monitoring.

  • ❌ [SAI] Use the current app-one-prod project as the scoping project.
    Sử dụng project app-one-prod (thuộc folder Production) làm scoping project chung. Sai vì: Project này chỉ có thể bind quyền đọc từ folder Production (nơi nó thuộc về), không thể dễ dàng isolate cho các folder khác mà không grant cross-folder permissions (rủi ro bảo mật cao). Dashboards sẽ lẫn metrics từ Production với các folder khác nếu cố bind rộng, vi phạm isolation.

  • ❌ [SAI] Use the current app-one-dev, app-one-staging, and app-one-prod projects as the scoping project for each folder.
    Sử dụng các project hiện có app-one- (dev/staging/prod)* làm scoping project cho từng folder tương ứng. Sai vì: Các project này là workload projects (chạy ứng dụng), không nên dùng làm scoping project (best practice: tách biệt để tránh ảnh hưởng production traffic). Bind quyền tại project-level sẽ khó scale cho multi-projects trong folder, và có thể gây confusion trong billing/permissions.


📘 Tài liệu tham khảo (cập nhật 2026):

💡 Lời khuyên thực hành: Sử dụng Terraform hoặc gcloud CLI để automate tạo scoping projects và IAM bindings, ví dụ: gcloud monitoring dashboards create --config-from-file=dashboard.yaml --scoping-project=SCOPE_PROJECT_ID.