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

Tìm thấy 358 câu.

Câu 201
Your company uses Cloud Logging to manage large volumes of log data. You need to build a real-time log analysis architecture that pushes logs to a third-party application for processing. What should you do?
  1. A Create a Cloud Logging log export to Pub/Sub.
  2. B Create a Cloud Logging log export to BigQuery.
  3. C Create a Cloud Logging log export to Cloud Storage.
  4. D Create a Cloud Function to read Cloud Logging log entries and send them to the third-party application.
Xem giải thích

🧩 Giải thích nội dung câu hỏi

Câu hỏi tập trung vào việc xây dựng một kiến trúc phân tích log thời gian thực (real-time) trên Google Cloud Logging – dịch vụ quản lý và phân tích log dữ liệu lớn. Yêu cầu chính là đẩy log từ Cloud Logging đến một ứng dụng bên thứ ba (third-party application) để xử lý ngay lập tức.

  • Bối cảnh: Cloud Logging lưu trữ và quản lý lượng log khổng lồ. Để real-time, cần cơ chế streaming (luồng dữ liệu liên tục), không phải lưu trữ batch (xử lý theo lô).
  • Mục tiêu: Tích hợp seamless với third-party, tận dụng tính năng log export của Cloud Logging để routing log ra ngoài mà không cần code phức tạp.
  • Kiến thức cập nhật 2026: Theo tài liệu Google Cloud mới nhất (Logging API v2, hỗ trợ real-time sinks qua Pub/Sub với độ trễ <1 giây), đây là best practice cho real-time ingestion.

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

✅ Đáp án đúng

Create a Cloud Logging log export to Pub/Sub.

Lý do lựa chọn:

  • Pub/Sub là dịch vụ messaging real-time (publish-subscribe), cho phép export log trực tiếp từ Cloud Logging dưới dạng message stream.
  • Third-party app có thể subscribe vào Pub/Sub topic để nhận log ngay lập tức, hỗ trợ xử lý lớn volumes với độ trễ thấp (sub-second).
  • Best practice cho real-time: Không cần code custom, scalable tự động, tích hợp native với Logging (filter log bằng query trước khi export).
  • Tiết kiệm chi phí, dễ monitor qua Logging metrics. ✅ Hoàn hảo cho kiến trúc event-driven!

🛠️ Phân tích tất cả các phương án

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

  • Create a Cloud Logging log export to Pub/Sub.
    ✅ Đúng. Như đã giải thích, đây là giải pháp real-time lý tưởng. Pub/Sub hoạt động như "cầu nối" streaming, third-party dễ kết nối via HTTP/ gRPC. Hỗ trợ filter log tinh vi (ví dụ: severity=ERROR), scale đến hàng triệu log/giây. (Cập nhật 2026: Tích hợp Pub/Sub Lite cho chi phí thấp hơn).

  • Create a Cloud Logging log export to BigQuery.
    ❌ Sai. BigQuery dành cho batch analytics (xử lý theo lô hàng ngày/giờ), không phải real-time (độ trễ vài phút). Phù hợp query SQL lớn, nhưng third-party khó "pull" real-time. Sẽ gây chậm trễ và không hiệu quả cho streaming đến app ngoài.

  • Create a Cloud Logging log export to Cloud Storage.
    ❌ Sai. Cloud Storage chỉ lưu trữ file JSON theo batch (giờ/ngày), không hỗ trợ streaming real-time. Third-party phải poll file liên tục (không scalable), tốn chi phí đọc/ghi, và thiếu tính năng push notification. Chỉ dùng cho archival dài hạn.

  • Create a Cloud Function to read Cloud Logging log entries and send them to the third-party application.
    ❌ Sai. Cloud Functions có thể trigger từ Logging, nhưng không hiệu quả cho large volumes real-time: Giới hạn concurrent (1k instances), cold start delay (2-10s), và phải query log thủ công via API (tốn token, polling). Không scalable như export native; dễ exceed quota. Best practice khuyên dùng Pub/Sub thay vì custom code. 🛑

Câu 202
You are developing a new public-facing application that needs to retrieve specific properties in the metadata of users’ objects in their respective Cloud Storage buckets. Due to privacy and data residency requirements, you must retrieve only the metadata and not the object data. You want to maximize the performance of the retrieval process. How should you retrieve the metadata?
  1. A Use the patch method.
  2. B Use the compose method.
  3. C Use the copy method.
  4. D Use the fields request parameter.
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 xoay quanh việc phát triển một ứng dụng công khai (public-facing application) cần lấy các thuộc tính cụ thể trong metadata của các object thuộc về người dùng trong các Cloud Storage buckets tương ứng của họ. 📦
Yêu cầu chính:

  • Tuân thủ quy định bảo mật (privacy) và lưu trú dữ liệu (data residency), nên chỉ lấy metadata, KHÔNG lấy dữ liệu object (object data).
  • Tối ưu hóa hiệu suất (maximize performance) cho quá trình lấy dữ liệu.
    🛠️ Bối cảnh: Đây là tình huống phổ biến trong Google Cloud Storage (GCS), nơi metadata chứa thông tin như size, content-type, custom metadata... mà không cần tải toàn bộ object (có thể rất lớn). Sử dụng API của GCS (JSON/XML API) để truy vấn hiệu quả, tránh tải dữ liệu không cần thiết, giảm băng thông và thời gian xử lý. Kiến thức dựa trên tài liệu GCS cập nhật đến 2026 (không thay đổi cơ bản từ các phiên bản trước).

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

✅ Đáp án đúng: Use the fields request parameter

Lý do chọn:

  • Phương án này cho phép chỉ định chính xác các trường metadata cần lấy (ví dụ: ?fields=size,contentType,metadata(myKey)) trong yêu cầu GET hoặc HEAD object.
  • Không tải object data, chỉ trả về metadata, giúp tối ưu performance bằng cách giảm kích thước response và băng thông.
  • Phù hợp hoàn hảo với yêu cầu privacy/data residency vì không truy cập data thực tế.
  • Trong GCS API (cập nhật 2026), đây là cách chuẩn, nhanh nhất cho public buckets (nếu object public hoặc có ACL phù hợp). 🏆

📋 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 giữ nguyên văn bản gốc bằng tiếng Anh, kèm giải thích chi tiết bằng tiếng Việt:

  • ❌ [SAI] Use the patch method.
    Phương án này sai vì patch method (PUT Object với If-Match hoặc partial update) dùng để cập nhật metadata (edit), không phải lấy (retrieve). Nó vẫn có thể tải hoặc ảnh hưởng đến object data, không tối ưu performance cho việc chỉ đọc metadata, và không phù hợp với yêu cầu chỉ retrieve.

  • ❌ [SAI] Use the compose method.
    Phương án này sai vì compose method dùng để kết hợp nhiều object thành một object mới (compositions), yêu cầu tải source objects (bao gồm data), tốn kém performance và vi phạm yêu cầu chỉ lấy metadata mà không chạm vào object data.

  • ❌ [SAI] Use the copy method.
    Phương án này sai vì copy method dùng để sao chép object (tạo bản sao), luôn tải và copy toàn bộ object data (bao gồm metadata), dẫn đến chi phí cao, thời gian lâu và không đáp ứng chỉ retrieve metadata riêng lẻ.

  • ✅ [ĐÚNG] Use the fields request parameter.
    Như đã giải thích ở trên: Đây là cách chính xác, hiệu quả nhất để lấy selective metadata mà không tải data, tối ưu cho ứng dụng public-facing với performance cao. Ví dụ API call: HEAD https://storage.googleapis.com/bucket/object?fields=metadata,size. 🚀

Câu 203 Chọn nhiều đáp án
You are deploying a microservices application to Google Kubernetes Engine (GKE) that will broadcast livestreams. You expect unpredictable traffic patterns and large variations in the number of concurrent users. Your application must meet the following requirements:

•Scales automatically during popular events and maintains high availability
•Is resilient in the event of hardware failures

How should you configure the deployment parameters? (Choose two.)
  1. A Distribute your workload evenly using a multi-zonal node pool.
  2. B Distribute your workload evenly using multiple zonal node pools.
  3. C Use cluster autoscaler to resize the number of nodes in the node pool, and use a Horizontal Pod Autoscaler to scale the workload.
  4. D Create a managed instance group for Compute Engine with the cluster nodes. Configure autoscaling rules for the managed instance group.
  5. E Create alerting policies in Cloud Monitoring based on GKE CPU and memory utilization. Ask an on-duty engineer to scale the workload by executing a script when CPU and memory usage exceed predefined thresholds.
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 việc triển khai ứng dụng microservices trên Google Kubernetes Engine (GKE) để phát sóng livestream, với lưu lượng truy cập không dự đoán được và số lượng người dùng đồng thời biến động lớn. Các yêu cầu chính bao gồm:

  • Tự động scale trong các sự kiện phổ biến và duy trì tính sẵn sàng cao (high availability).
  • Khả năng phục hồi khi xảy ra sự cố phần cứng (hardware failures).

Người dùng cần chọn hai cách cấu hình tham số deployment phù hợp nhất. Đây là tình huống điển hình trong GKE, nơi cần kết hợp phân bố workload đều (multi-zonal cho HA) và autoscaling tự động (cluster autoscaler + HPA) để xử lý traffic spike và failover tự động. Kiến thức dựa trên tài liệu GKE mới nhất (2024-2026): Node pools hỗ trợ multi-zonal/regional clusters, Cluster Autoscaler v1.30+, HPA với metrics tùy chỉnh.
📘 Tài liệu tham khảo:

✅ Đáp án đúng (Chọn 2)

Hai đáp án đúng là:

  1. Distribute your workload evenly using a multi-zonal node pool.
    🛠️ Lý do: Multi-zonal node pool tự động phân bố nodes đều qua nhiều availability zones (zones) trong cùng region, đảm bảo high availability và resilience trước hardware failures (GKE tự động repair/replace nodes). Phù hợp với traffic unpredictable vì workload cân bằng, tránh single point of failure. Đây là best practice cho GKE clusters từ phiên bản 1.21+.

  2. Use cluster autoscaler to resize the number of nodes in the node pool, and use a Horizontal Pod Autoscaler to scale the workload.
    🛠️ Lý do: Cluster Autoscaler tự động thêm/giảm nodes dựa trên pending pods (scale node pool), kết hợp HPA scale pods dựa trên CPU/memory/ custom metrics. Hoàn hảo cho traffic livestream biến động, đảm bảo scale nhanh (seconds cho pods, minutes cho nodes) và HA. Tích hợp native trong GKE Autopilot/Standard clusters (cập nhật 2026 vẫn là core feature).

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

Dưới đây là phân tích chi tiết từng lựa chọn, với ✅ cho đúng và ❌ cho sai:

  • ✅ Distribute your workload evenly using a multi-zonal node pool.
    🛠️ Đúng vì: Như giải thích trên, multi-zonal node pool phân bố nodes đều qua ≥2 zones, hỗ trợ HA và tự động cân bằng workload/pods. Giảm downtime <1% so với single-zone, lý tưởng cho livestream. (GKE docs: Regional clusters khuyến nghị).

  • ❌ Distribute your workload evenly using multiple zonal node pools.
    🧨 Sai vì: Multiple zonal node pools yêu cầu tạo thủ công nhiều pool (mỗi pool chỉ 1 zone), phức tạp hơn multi-zonal (tự động). Không đảm bảo phân bố "evenly" tự động, dễ imbalance workload nếu không config topology spread constraints. Không phải best practice cho HA.

  • ✅ Use cluster autoscaler to resize the number of nodes in the node pool, and use a Horizontal Pod Autoscaler to scale the workload.
    🛠️ Đúng vì: Kết hợp hoàn hảo: HPA scale pods nhanh (dựa metrics realtime), Cluster Autoscaler scale nodes khi pods pending. Xử lý traffic spike livestream hiệu quả, resilient với failures (tự heal). Hỗ trợ GKE 1.29+ với metrics Prometheus.

  • ❌ Create a managed instance group for Compute Engine with the cluster nodes. Configure autoscaling rules for the managed instance group.
    🧨 Sai vì: GKE sử dụng node pools (abstraction trên MIG), không cần tạo MIG thủ công cho cluster nodes. Việc này duplicate và conflict với GKE autoscaler, gây instability. MIG dành cho GCE standalone, không integrate tốt với Kubernetes scheduler (deprecated approach từ 2022).

  • ❌ Create alerting policies in Cloud Monitoring based on GKE CPU and memory utilization. Ask an on-duty engineer to scale the workload by executing a script when CPU and memory usage exceed predefined thresholds.
    🧨 Sai vì: Đây là cách thủ công, phụ thuộc engineer on-duty (không tự động scale realtime). Không đáp ứng "scales automatically" cho traffic unpredictable. Cloud Monitoring tốt cho alerting, nhưng phải kết hợp autoscalers native thay vì script manual (vi phạm SRE principles, latency cao >minutes).

Câu 204
You work at a rapidly growing financial technology startup. You manage the payment processing application written in Go and hosted on Cloud Run in the Singapore region (asia-southeast1). The payment processing application processes data stored in a Cloud Storage bucket that is also located in the Singapore region.

The startup plans to expand further into the Asia Pacific region. You plan to deploy the Payment Gateway in Jakarta, Hong Kong, and Taiwan over the next six months. Each location has data residency requirements that require customer data to reside in the country where the transaction was made. You want to minimize the cost of these deployments. What should you do?
  1. A Create a Cloud Storage bucket in each region, and create a Cloud Run service of the payment processing application in each region.
  2. B Create a Cloud Storage bucket in each region, and create three Cloud Run services of the payment processing application in the Singapore region.
  3. C Create three Cloud Storage buckets in the Asia multi-region, and create three Cloud Run services of the payment processing application in the Singapore region.
  4. D Create three Cloud Storage buckets in the Asia multi-region, and create three Cloud Run revisions of the payment processing application in the Singapore region.
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 startup fintech đang phát triển nhanh chóng, quản lý ứng dụng xử lý thanh toán viết bằng Go, được triển khai trên Cloud Run tại vùng Singapore (asia-southeast1). Ứng dụng này xử lý dữ liệu lưu trữ trong một Cloud Storage bucket cũng nằm tại Singapore.

Startup dự định mở rộng sang Jakarta (asia-southeast2), Hong Kong (asia-east2) và Taiwan (asia-east1) trong 6 tháng tới. Mỗi địa điểm có yêu cầu data residency nghiêm ngặt: dữ liệu khách hàng phải lưu trữ trong quốc gia nơi giao dịch diễn ra (không được lưu ở nơi khác).

Mục tiêu: Triển khai Payment Gateway tại các vùng mới, đồng thời tối thiểu hóa chi phí.
🛠️ Thách thức chính:

  • Đảm bảo data residency cho Cloud Storage (dữ liệu phải ở đúng vùng quốc gia tương ứng).
  • Cloud Run cần xử lý dữ liệu địa phương với độ trễ thấp, chi phí thấp.
  • Không dùng giải pháp phức tạp/đắt đỏ như multi-cluster hay global load balancing.

(Kiến thức cập nhật GCP đến 2026: Cloud Storage single-region buckets đảm bảo residency theo vùng cụ thể; Cloud Run hỗ trợ deploy fully managed per region với autoscaling, chi phí pay-per-use thấp. Multi-region buckets chỉ replicate trong "asia" nhưng không cam kết residency per-country theo quy định pháp lý như Indonesia, HK, Taiwan.)

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

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

Đáp án đúng: Create a Cloud Storage bucket in each region, and create a Cloud Run service of the payment processing application in each region.

Lý do:

  • 🗂️ Cloud Storage: Tạo bucket single-region tại mỗi vùng (Jakarta: asia-southeast2, Hong Kong: asia-east2, Taiwan: asia-east1) đảm bảo data residency 100% (dữ liệu chỉ lưu trong quốc gia đó, tuân thủ luật địa phương).
  • 🚀 Cloud Run: Tạo service riêng tại mỗi vùng để ứng dụng Go xử lý dữ liệu địa phương với độ trễ thấp nhất (latency <50ms intra-region), autoscaling tự động, và chi phí tối thiểu (pay-per-request, cold starts nhanh). Không cần traffic splitting hay global services đắt đỏ.
  • 💰 Tối ưu chi phí: Deploy per-region đơn giản, không egress fees cao giữa regions, tổng chi phí thấp hơn multi-region setups (dựa trên GCP pricing calculator 2026).

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

  • Phương án 1: Create a Cloud Storage bucket in each region, and create a Cloud Run service of the payment processing application in each region.
    ✅ Đúng: Như giải thích trên, hoàn hảo đáp ứng residency (buckets single-region), performance (Cloud Run local), và chi phí thấp. Đây là cách best practice cho multi-region fintech với residency strict (GCP recommends per-region for compliance).

  • Phương án 2: Create a Cloud Storage bucket in each region, and create three Cloud Run services of the payment processing application in the Singapore region.
    ❌ Sai: Buckets đúng (residency OK), nhưng Cloud Run ở Singapore gây latency cao (200-500ms từ Jakarta/Taiwan), tăng chi phí network egress, và không tối ưu (app xa dữ liệu). Vi phạm nguyên tắc low-latency processing.

  • Phương án 3: Create three Cloud Storage buckets in the Asia multi-region, and create three Cloud Run services of the payment processing application in the Singapore region.
    ❌ Sai: Asia multi-region buckets replicate dữ liệu qua nhiều zones (Singapore, Taiwan, HK, etc.) nhưng KHÔNG đảm bảo residency per-country (dữ liệu có thể lưu ở Singapore cho transaction Jakarta, vi phạm luật). Cloud Run ở Singapore thêm latency/egress cao, chi phí không min.

  • Phương án 4: Create three Cloud Storage buckets in the Asia multi-region, and create three Cloud Run revisions of the payment processing application in the Singapore region.
    ❌ Sai: Buckets multi-region vẫn fail residency như phương án 3. Cloud Run revisions chỉ là phiên bản khác nhau của cùng một service (không multi-region), vẫn chạy ở Singapore → latency cao, không scale geo, chi phí không giảm. Revisions dùng cho canary/blue-green, không phải geo-deploy.

Câu 205
You recently joined a new team that has a Cloud Spanner database instance running in production. Your manager has asked you to optimize the Spanner instance to reduce cost while maintaining high reliability and availability of the database. What should you do?
  1. A Use Cloud Logging to check for error logs, and reduce Spanner processing units by small increments until you find the minimum capacity required.
  2. B Use Cloud Trace to monitor the requests per sec of incoming requests to Spanner, and reduce Spanner processing units by small increments until you find the minimum capacity required.
  3. C Use Cloud Monitoring to monitor the CPU utilization, and reduce Spanner processing units by small increments until you find the minimum capacity required.
  4. D Use Snapshot Debugger to check for application errors, and reduce Spanner processing units by small increments until you find the minimum capacity required.
Xem giải thích

🧩 Giải thích nội dung câu hỏi

Câu hỏi xoay quanh việc tối ưu hóa chi phí cho một instance Cloud Spanner đang chạy production trong Google Cloud Platform (GCP). Cloud Spanner là dịch vụ cơ sở dữ liệu phân tán toàn cầu, có khả năng mở rộng tự động và độ tin cậy cao (high availability). Nhiệm vụ là giảm chi phí bằng cách giảm Spanner processing units (PU) – đơn vị tính toán đại diện cho tài nguyên CPU và lưu trữ – mà vẫn duy trì độ tin cậy và tính sẵn sàng cao.

Quy trình tối ưu yêu cầu giám sát các chỉ số hiệu suất để tránh giảm quá mức dẫn đến downtime hoặc hiệu suất kém. Bạn cần chọn công cụ phù hợp để theo dõi và giảm PU dần dần (small increments) đến mức tối thiểu cần thiết. 📈 Kiến thức cập nhật: Theo tài liệu GCP mới nhất (2024-2026), Cloud Spanner hỗ trợ autoscaling dựa trên metrics từ Cloud Monitoring, và CPU utilization là chỉ số chính để right-size instance (xem Cloud Spanner Monitoring).

✅ Đáp án đúng

Use Cloud Monitoring to monitor the CPU utilization, and reduce Spanner processing units by small increments until you find the minimum capacity required.

Lý do chọn đáp án này: Cloud Monitoring là công cụ chính thức của GCP để theo dõi metrics hệ thống như CPU utilization (%) của Spanner nodes. Bằng cách giám sát CPU (nên giữ dưới 70-80% để tránh bottleneck), bạn có thể giảm PU an toàn từng bước nhỏ (ví dụ: 100 PU/lần), đảm bảo high reliability. Đây là best practice từ GCP: sử dụng dashboards/alerts trong Cloud Monitoring để right-size Spanner mà không ảnh hưởng SLA 99.999% availability. 🛠️ Nguồn: Optimize Cloud Spanner Capacity và Cloud Monitoring Metrics.

📋 Phân tích tất cả các phương án

Dưới đây là phân tích chi tiết từng lựa chọn. Tôi giữ nguyên văn bản gốc bằng tiếng Anh, và giải thích tại sao đúng/sai bằng tiếng Việt. Sử dụng ✅ cho đúng, ❌ cho sai.

  • ❌ [SAI] Use Cloud Logging to check for error logs, and reduce Spanner processing units by small increments until you find the minimum capacity required.
    Giải thích: Cloud Logging chỉ dùng để thu thập và phân tích logs lỗi (error logs), không cung cấp metrics hiệu suất như CPU hay throughput. Sử dụng nó không giúp xác định capacity tối thiểu, có thể dẫn đến giảm PU mù quáng gây downtime. Không phù hợp cho optimization capacity. 🗂️ Nguồn: Cloud Logging vs Monitoring.

  • ❌ [SAI] Use Cloud Trace to monitor the requests per sec of incoming requests to Spanner, and reduce Spanner processing units by small increments until you find the minimum capacity required.
    Giải thích: Cloud Trace chuyên tracing latency và requests/sec (RPS) cho ứng dụng phân tán, không phải metrics hệ thống như CPU của Spanner. RPS chỉ cho biết workload, nhưng không trực tiếp chỉ ra over-provisioning CPU, dễ gây under-capacity nếu giảm PU dựa trên nó. ❌ Không phải tool chính cho Spanner sizing.

  • ✅ [ĐÚNG] Use Cloud Monitoring to monitor the CPU utilization, and reduce Spanner processing units by small increments until you find the minimum capacity required.
    Giải thích: Như đã nêu ở trên, đây là lựa chọn chuẩn. CPU utilization là metric cốt lõi (spanner.googleapis.com/instance/node/cpu_utilization) trong Cloud Monitoring, giúp detect idle resources và scale down an toàn. GCP khuyến nghị set alerts khi CPU <50% để optimize. 📊 Nguồn: Spanner Best Practices.

  • ❌ [SAI] Use Snapshot Debugger to check for application errors, and reduce Spanner processing units by small increments until you find the minimum capacity required.
    Giải thích: Snapshot Debugger dùng để debug code runtime trong ứng dụng (như Java/Python), không liên quan đến monitoring database capacity hay CPU của Spanner. Nó chỉ chụp snapshots biến trạng thái app, không giúp optimize PU. Hoàn toàn không phù hợp! 🐛 Nguồn: Cloud Debugger Overview.

🏆 Kết luận và khuyến nghị

Sử dụng Cloud Monitoring là cách an toàn, hiệu quả nhất để right-size Spanner, giảm chi phí lên đến 50% mà giữ high availability. Hãy thiết lập custom dashboards và alerting policies ngay! Nếu áp dụng thực tế, test ở staging trước. 🔗 Tài liệu tham khảo chính:

Câu 206
You recently deployed a Go application on Google Kubernetes Engine (GKE). The operations team has noticed that the application's CPU usage is high even when there is low production traffic. The operations team has asked you to optimize your application's CPU resource consumption. You want to determine which Go functions consume the largest amount of CPU. What should you do?
  1. A Deploy a Fluent Bit daemonset on the GKE cluster to log data in Cloud Logging. Analyze the logs to get insights into your application code’s performance.
  2. B Create a custom dashboard in Cloud Monitoring to evaluate the CPU performance metrics of your application.
  3. C Connect to your GKE nodes using SSH. Run the top command on the shell to extract the CPU utilization of your application.
  4. D Modify your Go application to capture profiling data. Analyze the CPU metrics of your application in flame graphs in Profiler.
Xem giải thích

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

✅ Giải thích nội dung câu hỏi:
Câu hỏi mô tả tình huống bạn đã triển khai một ứng dụng viết bằng ngôn ngữ Go trên Google Kubernetes Engine (GKE). Đội ngũ vận hành (operations team) nhận thấy ứng dụng tiêu thụ CPU cao ngay cả khi lưu lượng sản xuất (production traffic) thấp. Họ yêu cầu tối ưu hóa tài nguyên CPU của ứng dụng. Nhiệm vụ cụ thể là xác định những hàm (functions) Go nào đang tiêu thụ nhiều CPU nhất.
🛠️ Mục tiêu chính: Không chỉ theo dõi CPU tổng thể mà cần phân tích chi tiết đến mức hàm code (function-level profiling) để tối ưu hóa hiệu suất ứng dụng. Đây là vấn đề phổ biến trong phát triển cloud-native trên GKE, nơi cần công cụ profiling chuyên sâu thay vì chỉ metrics tổng quát. (Kiến thức cập nhật đến 2026: Google Cloud Profiler hỗ trợ Go runtime profiling với flame graphs cho CPU, heap, contention – phiên bản mới nhất tích hợp seamless với GKE Autopilot và Alloy).

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

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

Đáp án đúng: Modify your Go application to capture profiling data. Analyze the CPU metrics of your application in flame graphs in Profiler.

🧩 Lý do chi tiết:
Phương án này trực tiếp giải quyết vấn đề bằng cách sử dụng Google Cloud Profiler – công cụ chuyên dụng để thu thập và phân tích dữ liệu profiling CPU từ ứng dụng Go. Bạn chỉ cần thêm vài dòng code import package cloud.google.com/go/profiler vào ứng dụng, kích hoạt profiling tự động gửi dữ liệu lên Profiler. Sau đó, xem flame graphs trực quan để xác định chính xác hàm Go nào "ăn" CPU nhiều nhất (ví dụ: loops, allocations). Đây là cách tối ưu nhất, không xâm phạm production, hỗ trợ real-time và historical data trên GKE (cập nhật 2026: Tích hợp với Workload Identity và serverless export). Các phương án khác chỉ cung cấp metrics cấp cao, không drill-down đến function-level.

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

  • [SAI] Deploy a Fluent Bit daemonset on the GKE cluster to log data in Cloud Logging. Analyze the logs to get insights into your application code’s performance.
    ❌ Lý do sai: Fluent Bit là agent thu thập logs (DaemonSet trên GKE gửi log vào Cloud Logging). Logs hữu ích cho debugging errors hoặc traces, nhưng không cung cấp profiling CPU chi tiết đến mức hàm Go. Phân tích log chỉ cho insights bề mặt (như timestamps), không đo lường CPU consumption per function. Sử dụng sai công cụ – logs ≠ profiling.

  • [SAI] Create a custom dashboard in Cloud Monitoring to evaluate the CPU performance metrics of your application.
    ❌ Lý do sai: Cloud Monitoring (trước là Stackdriver) cung cấp metrics tổng quát như CPU utilization của Pod/Node/container (qua Metrics Explorer hoặc dashboard tùy chỉnh). Tuyệt vời cho alerting cao/thấp traffic, nhưng không phân tích sâu vào code functions. Bạn chỉ thấy "CPU cao" mà không biết hàm nào gây ra – thiếu granularity cho optimization code-level.

  • [SAI] Connect to your GKE nodes using SSH. Run the top command on the shell to extract the CPU utilization of your application.
    ❌ Lý do sai: SSH vào GKE nodes (qua gcloud compute ssh) và chạy top chỉ hiển thị CPU/process-level (như PID của container). Không thể xác định hàm Go cụ thể bên trong binary – chỉ biết process nào "nặng" chứ không drill-down code. Không scale cho production (manual, insecure), và GKE khuyến nghị tránh SSH trực tiếp (dùng Exec vào Pod thay thế).

  • [ĐÚNG] Modify your Go application to capture profiling data. Analyze the CPU metrics of your application in flame graphs in Profiler.
    ✅ Lý do đúng (như đã giải thích ở trên): Đây là best practice chính thức của Google Cloud cho Go apps trên GKE. Flame graphs trực quan hóa CPU hotspots, dễ integrate với CI/CD, zero-overhead sampling (<5% CPU thêm). Hỗ trợ multi-service profiling trên cluster lớn.

Câu 207
Your team manages a Google Kubernetes Engine (GKE) cluster where an application is running. A different team is planning to integrate with this application. Before they start the integration, you need to ensure that the other team cannot make changes to your application, but they can deploy the integration on GKE. What should you do?
  1. A Using Identity and Access Management (IAM), grant the Viewer IAM role on the cluster project to the other team.
  2. B Create a new GKE cluster. Using Identity and Access Management (IAM), grant the Editor role on the cluster project to the other team.
  3. C Create a new namespace in the existing cluster. Using Identity and Access Management (IAM), grant the Editor role on the cluster project to the other team.
  4. D Create a new namespace in the existing cluster. Using Kubernetes role-based access control (RBAC), grant the Admin role on the new namespace to the other team.
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 giải thích rõ ràng:
Câu hỏi xoay quanh việc quản lý quyền truy cập trong Google Kubernetes Engine (GKE) cluster trên Google Cloud Platform (GCP). Đội ngũ của bạn đang chạy một ứng dụng trên cluster GKE hiện tại. Một đội ngũ khác muốn tích hợp (integrate) với ứng dụng này, nghĩa là họ cần triển khai (deploy) phần tích hợp của họ trên cùng cluster GKE để có thể giao tiếp trực tiếp (ví dụ: qua Service, Ingress). Tuy nhiên, yêu cầu quan trọng là:

  • Đội kia KHÔNG được phép thay đổi (make changes) ứng dụng của đội bạn (tức là không edit, delete resources trong namespace của ứng dụng).
  • Họ CHỈ được phép deploy phần tích hợp của mình trên GKE.
    Mục tiêu là sử dụng cơ chế quyền hạn phù hợp để cô lập quyền truy cập, đảm bảo an toàn và tuân thủ nguyên tắc least privilege (quyền tối thiểu cần thiết). Đây là tình huống phổ biến trong multi-tenancy trên Kubernetes, nơi nhiều team chia sẻ cluster nhưng cần isolation.
    (Kiến thức cập nhật: GKE phiên bản mới nhất 2024-2026 hỗ trợ RBAC Kubernetes chuẩn và Workload Identity Federation cho IAM tích hợp mượt mà – tham khảo GKE Documentation: RBAC.)

✅ Đáp án đúng và lý do lựa chọn:
Đáp án đúng là: Create a new namespace in the existing cluster. Using Kubernetes role-based access control (RBAC), grant the Admin role on the new namespace to the other team.
🛠️ Lý do chi tiết:

  • Tạo namespace mới trong cùng cluster hiện tại cho phép đội kia deploy resources (Pod, Deployment, Service) vào namespace riêng, dễ dàng integrate với app của bạn qua cross-namespace communication (như NetworkPolicy nếu cần).
  • Sử dụng Kubernetes RBAC (không phải IAM GCP) để grant Admin role chỉ trên namespace mới: Họ có quyền đầy đủ (create, edit, delete) trong namespace của họ, nhưng không chạm vào namespace của app bạn (least privilege). RBAC là cơ chế native của Kubernetes, granular hơn IAM cho workload-level.
  • Điều này tránh rủi ro: Không cần cluster mới (tốn kém), không grant quyền project-wide. Hoàn hảo cho multi-team setup trên GKE Autopilot/Standard.
    (Nguồn: Kubernetes RBAC Docs & GKE RBAC Best Practices.)

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

  • ❌ [SAI] Using Identity and Access Management (IAM), grant the Viewer IAM role on the cluster project to the other team.
    Phương án này chỉ cấp quyền Viewer (roles/viewer) IAM trên project chứa cluster: Họ chỉ read-only (xem logs, metrics, describe resources), không deploy được bất kỳ workload nào (không create Pod/Deployment). Không đáp ứng yêu cầu "deploy the integration". IAM Viewer quá hạn chế cho Kubernetes operations.

  • ❌ [SAI] Create a new GKE cluster. Using Identity and Access Management (IAM), grant the Editor role on the cluster project to the other team.
    Tạo cluster mới làm họ deploy riêng biệt, không integrate trực tiếp với app trên cluster cũ (cần VPC peering, federation phức tạp, tốn chi phí). Grant Editor (roles/editor) IAM trên project mới cho quyền rộng (edit toàn bộ resources), vi phạm "cannot make changes to your application" (họ có thể manage cluster của bạn nếu project share).

  • ❌ [SAI] Create a new namespace in the existing cluster. Using Identity and Access Management (IAM), grant the Editor role on the cluster project to the other team.
    Tạo namespace mới là đúng hướng (isolation), nhưng grant Editor IAM trên project cấp quyền project-wide (quản lý cluster, nodes, secrets toàn bộ – bao gồm namespace app của bạn). Họ có thể thay đổi app của bạn (delete Deployment), không an toàn. IAM không granular như RBAC cho namespace.

  • ✅ [ĐÚNG] Create a new namespace in the existing cluster. Using Kubernetes role-based access control (RBAC), grant the Admin role on the new namespace to the other team.
    Như đã giải thích ở trên: Isolation hoàn hảo qua namespace + RBAC chỉ scope namespace mới. Họ deploy thoải mái trong "vùng đất" riêng, integrate an toàn với app bạn qua cluster-internal networking. Best practice cho GKE 2026!
    (Nguồn bổ sung: GKE Multi-Tenancy Guide.)

Câu 208
You have recently instrumented a new application with OpenTelemetry, and you want to check the latency of your application requests in Trace. You want to ensure that a specific request is always traced. What should you do?
  1. A Wait 10 minutes, then verify that Trace captures those types of requests automatically.
  2. B Write a custom script that sends this type of request repeatedly from your dev project.
  3. C Use the Trace API to apply custom attributes to the trace.
  4. D Add the X-Cloud-Trace-Context header to the request with the appropriate parameters.
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 chủ đề Google Cloud Trace (một phần của Google Cloud Monitoring), liên quan đến việc sử dụng OpenTelemetry để instrument (thêm instrumentation) một ứng dụng mới. Mục tiêu là kiểm tra độ trễ (latency) của các request ứng dụng trong Trace, và đặc biệt đảm bảo rằng một request cụ thể luôn được trace (không bị bỏ lỡ do sampling).

🛠️ Bối cảnh kỹ thuật:

  • OpenTelemetry là tiêu chuẩn mở để thu thập telemetry data (traces, metrics, logs).
  • Google Cloud Trace tự động sampling (lấy mẫu) một phần traces để tiết kiệm chi phí, nên không phải request nào cũng được trace đầy đủ.
  • Để force trace một request cụ thể, cần can thiệp thủ công vào propagation của trace context qua HTTP header.
  • Kiến thức cập nhật đến 2026: Theo tài liệu Google Cloud Trace v2 (phiên bản mới nhất), header X-Cloud-Trace-Context vẫn là cách chuẩn để enable tracing bắt buộc (với tham số o=1 cho always-on sampling). OpenTelemetry tích hợp native với Cloud Trace qua exporter.

📘 Nguồn tham khảo:

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

Đáp án đúng: Add the X-Cloud-Trace-Context header to the request with the appropriate parameters.

Lý do 🟢:

  • Header X-Cloud-Trace-Context (hoặc traceparent trong W3C chuẩn) truyền trace context giữa các service, với tham số o=1 (options=1) bắt buộc sampling luôn ON cho request đó và các span con.
  • Điều này đảm bảo 100% request cụ thể được trace, giúp kiểm tra latency ngay lập tức mà không phụ thuộc vào sampling ngẫu nhiên.
  • Phù hợp với OpenTelemetry propagation, hoạt động seamless trên Google Cloud.

📋 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 bằng tiếng Anh, kèm giải thích sai/đúng bằng tiếng Việt:

  • ❌ Wait 10 minutes, then verify that Trace captures those types of requests automatically.
    Sai vì: Cloud Trace chỉ tự động sampling một phần nhỏ (thường 1/1000 requests), không đảm bảo "always traced". Việc chờ 10 phút chỉ kiểm tra ngẫu nhiên, không force trace request cụ thể, dễ miss latency data cần kiểm tra.

  • ❌ Write a custom script that sends this type of request repeatedly from your dev project.
    Sai vì: Script chỉ tạo volume request lớn để tăng xác suất sampling, nhưng vẫn phụ thuộc ngẫu nhiên (không "always"). Không giải quyết vấn đề force trace, tốn tài nguyên dev mà không chính xác.

  • ❌ Use the Trace API to apply custom attributes to the trace.
    Sai vì: Trace API (như patchTraces) dùng để thêm attributes sau khi trace đã tồn tại, không force tạo trace mới. Attributes chỉ enrich data (ví dụ: labels), không kiểm soát sampling cho request incoming.

  • ✅ Add the X-Cloud-Trace-Context header to the request with the appropriate parameters.
    Đúng vì: Như giải thích trên, header này truyền trace ID + bật sampling bắt buộc (o=1), đảm bảo request luôn được capture đầy đủ trong Trace UI để xem latency chính xác. Hỗ trợ OpenTelemetry exporter tự động propagate.

🧪 Lời khuyên thực hành: Test bằng curl: curl -H "X-Cloud-Trace-Context: 0123456789abcdef0123456789abcdef/1;o=1" your-app-url. Xem trace ngay trong Console > Monitoring > Trace! 🚀

Câu 209
You are trying to connect to your Google Kubernetes Engine (GKE) cluster using kubectl from Cloud Shell. You have deployed your GKE cluster with a public endpoint. From Cloud Shell, you run the following command:

gcloud container clusters get-credentials  \
--zone  --project  \


You notice that the kubectl commands time out without returning an error message. What is the most likely cause of this issue?
  1. A Your user account does not have privileges to interact with the cluster using kubectl.
  2. B Your Cloud Shell external IP address is not part of the authorized networks of the cluster.
  3. C The Cloud Shell is not part of the same VPC as the GKE cluster.
  4. D A VPC firewall is blocking access to the cluster’s endpoint.
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ả tình huống bạn đang cố gắng kết nối đến một Google Kubernetes Engine (GKE) cluster bằng công cụ kubectl từ Cloud Shell. Cluster đã được triển khai với public endpoint (điểm cuối công khai). Bạn chạy lệnh sau để lấy credentials:

gcloud container clusters get-credentials <cluster-name> \
--zone <zone> --project <project-name> \

Lệnh này thành công (không báo lỗi), nhưng khi chạy các lệnh kubectl (như kubectl get pods), chúng timeout (hết thời gian chờ) mà không trả về thông báo lỗi cụ thể.

Vấn đề cốt lõi: Lệnh get-credentials chỉ cập nhật file kubeconfig với thông tin xác thực (auth token), nhưng không giải quyết vấn đề kết nối mạng đến control plane của GKE. Với public endpoint, GKE yêu cầu IP nguồn phải nằm trong danh sách authorized networks (mạng được ủy quyền) để truy cập HTTPS port 443 của master endpoint. Cloud Shell sử dụng external IP động (thay đổi theo session), thường không được authorize mặc định, dẫn đến timeout khi cố gắng kết nối. Đây là hành vi phổ biến theo tài liệu GKE mới nhất (2024-2026), nơi control plane bảo vệ bằng IP whitelist thay vì chỉ firewall.

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

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

Đáp án đúng: Your Cloud Shell external IP address is not part of the authorized networks of the cluster.

Lý do:

  • 🛠️ Với GKE public endpoint (mặc định), control plane chỉ chấp nhận kết nối từ các IP trong Master authorized networks (cấu hình lúc tạo cluster qua --enable-private-endpoint hoặc console).
  • Cloud Shell có external IP public động (không fixed), không nằm trong authorized list → kubectl timeout sau ~30-60 giây mà không lỗi auth (vì auth đã OK từ gcloud).
  • Giải pháp: Thêm IP Cloud Shell vào authorized networks (dùng gcloud container clusters update --enable-master-authorized-networks --master-authorized-networks=<IP>/32), hoặc dùng Workload Identity / private cluster. Đây là nguyên nhân most likely theo best practices GKE 2024+.

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

  • ❌ [SAI] Your user account does not have privileges to interact with the cluster using kubectl.
    Phương án này sai vì nếu thiếu quyền IAM (như roles/container.developer), lệnh kubectl sẽ báo lỗi rõ ràng như "Forbidden" hoặc "Unauthorized" ngay lập tức, không phải timeout im lặng. Lệnh gcloud get-credentials đã dùng IAM để lấy token → auth OK.

  • ✅ [ĐÚNG] Your Cloud Shell external IP address is not part of the authorized networks of the cluster.
    Như giải thích trên: Đây là nguyên nhân chính xác nhất. GKE control plane chặn IP không authorize ở layer mạng (TCP SYN timeout), phù hợp triệu chứng timeout without error.

  • ❌ [SAI] The Cloud Shell is not part of the same VPC as the GKE cluster.
    Sai vì với public endpoint, truy cập kubectl từ bất kỳ đâu (không cần same VPC). Cloud Shell dùng internet public → chỉ cần IP authorize và firewall cho phép port 443. Same VPC chỉ bắt buộc với private endpoint + private Cloud Shell.

  • ❌ [SAI] A VPC firewall is blocking access to the cluster’s endpoint.
    Sai vì VPC firewall chủ yếu kiểm soát traffic internal (nodes/pods), không ảnh hưởng trực tiếp đến public control plane endpoint (managed bởi Google). Authorized networks là lớp bảo vệ chính; firewall chỉ bổ sung nếu custom rules chặn egress từ Cloud Shell (ít likely hơn). Triệu chứng firewall thường là "connection refused", không pure timeout.

Câu 210
You are developing a web application that contains private images and videos stored in a Cloud Storage bucket. Your users are anonymous and do not have Google Accounts. You want to use your application-specific logic to control access to the images and videos. How should you configure access?
  1. A Cache each web application user's IP address to create a named IP table using Google Cloud Armor. Create a Google Cloud Armor security policy that allows users to access the backend bucket.
  2. B Grant the Storage Object Viewer IAM role to allUsers. Allow users to access the bucket after authenticating through your web application.
  3. C Configure Identity-Aware Proxy (IAP) to authenticate users into the web application. Allow users to access the bucket after authenticating through IAP.
  4. D Generate a signed URL that grants read access to the bucket. Allow users to access the URL after authenticating through your web application.
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 phát triển một ứng dụng web chứa hình ảnh và video riêng tư được lưu trữ trong Google Cloud Storage bucket. Người dùng của ứng dụng là anonymous (không đăng nhập, không có Google Accounts), và bạn cần sử dụng logic cụ thể của ứng dụng để kiểm soát quyền truy cập vào các tài nguyên này. Mục tiêu là cấu hình quyền truy cập sao cho an toàn, linh hoạt, không yêu cầu người dùng phải xác thực qua Google, nhưng vẫn đảm bảo chỉ những người dùng hợp lệ (qua logic app) mới xem được nội dung.

🛠️ Yêu cầu chính:

  • Nội dung private (không public).
  • Kiểm soát qua app logic (ví dụ: sau khi app xác thực người dùng theo cách riêng).
  • Không dùng tài khoản Google cho users.
  • Giải pháp phải tuân thủ best practices của Google Cloud Storage (cập nhật đến 2026: Signed URLs vẫn là chuẩn cho temporary access, hỗ trợ HMAC keys và service accounts).

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

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

Đáp án đúng: Generate a signed URL that grants read access to the bucket. Allow users to access the URL after authenticating through your web application.

Lý do chi tiết 🏆:

  • Signed URL cho phép tạo liên kết tạm thời (có thời hạn, quyền cụ thể như read-only) đến object trong bucket mà không cần người dùng xác thực với Google. App của bạn sử dụng service account để ký URL, sau đó kiểm tra logic nội bộ (ví dụ: session, token custom) trước khi cung cấp URL cho user.
  • Hoàn hảo cho users anonymous: App control toàn bộ (auth qua app, rồi generate URL).
  • An toàn cao: URL hết hạn tự động, tránh public access. Hỗ trợ V4 signing (mới nhất 2026) với query params linh hoạt.
  • Tuân thủ zero-trust model của Google Cloud.

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

  • [SAI] Cache each web application user's IP address to create a named IP table using Google Cloud Armor. Create a Google Cloud Armor security policy that allows users to access the backend bucket.
    ❌ Sai vì: Cloud Armor dùng cho bảo vệ DDoS/WAF tại Load Balancer, không phải kiểm soát access đến Storage bucket trực tiếp. Cache IP không đáng tin cậy (IP động, proxy/VPN), không dùng app logic, và bucket không hỗ trợ Armor policy native. Rủi ro cao: Không private thực sự, dễ bypass.

  • [SAI] Grant the Storage Object Viewer IAM role to allUsers. Allow users to access the bucket after authenticating through your web application.
    ❌ Sai vì: allUsers (public) làm bucket/object public hoàn toàn, ai cũng đọc được qua gs:// URL mà không cần app auth. Mâu thuẫn với yêu cầu private + app logic control. Vi phạm nguyên tắc least privilege (IAM best practice).

  • [SAI] Configure Identity-Aware Proxy (IAP) to authenticate users into the web application. Allow users to access the bucket after authenticating through IAP.
    ❌ Sai vì: IAP yêu cầu Google Accounts hoặc federated identity (OAuth), không phù hợp với users anonymous/no Google Accounts. IAP bảo vệ app/VM, không trực tiếp cho Storage access. Users phải auth qua Google – trái yêu cầu.

  • [ĐÚNG] Generate a signed URL that grants read access to the bucket. Allow users to access the URL after authenticating through your web application.
    ✅ Đúng vì: Như giải thích trên – linh hoạt, an toàn, app-centric control. Signed URL (V4) là giải pháp chuẩn cho temporary read access private objects (xem docs 2025-2026).

🧠 Lời khuyên thực hành: Trong code (Node.js/Python), dùng @google-cloud/storage library để generate signed URL sau app auth. Test với gsutil signurl cho dev!