Google Professional Cloud DevOps Engineer Question 22
Single answerGoogle Cloud PlatformYou are a DevOps Engineer managing a Google Cloud environment for an e-commerce platform. Your team has identified a need to automate the deployment of a new feature across multiple Kubernetes clusters. The deployment process involves: 1) Pulling the latest Docker image from a container registry, 2) Updating specific Kubernetes manifests, and 3) Applying the updated manifests to the clusters. Which of the following approaches would be the most efficient and maintainable for automating this process?
- A
Write a Python script that uses the Kubernetes and Docker APIs to manage the deployment process.
- B
Use a Bash script with kubectl commands and Docker CLI to automate the deployment.
- C
Leverage a CI/CD tool like Cloud Build or Jenkins to create an automated pipeline for pulling images, updating manifests, and applying changes.
- D
Manually perform each step in the deployment process to ensure accuracy and control.
Show answer and explanation
Correct answer: C
Explanation
The correct answer is to use a CI/CD tool like Cloud Build or Jenkins to automate the deployment. This approach aligns with the principles of DevOps by promoting automation, scalability, and reliability. CI/CD tools are purpose-built for managing complex workflows and can seamlessly integrate with Kubernetes and container registries. While scripting with Python or Bash can work, they require more maintenance and are harder to scale compared to a CI/CD pipeline.
- A. Incorrect.
Using Python with Kubernetes and Docker APIs is a flexible approach, but it requires significant development effort and maintenance. It may not be as efficient or maintainable as leveraging a dedicated CI/CD tool.
- B. Incorrect.
A Bash script can work but is less maintainable and harder to scale compared to using a CI/CD pipeline. Debugging and error handling are also more complex in this approach.
- C. Correct.
Leveraging a CI/CD tool like Cloud Build or Jenkins is the most efficient and maintainable approach for automating multi-step deployment processes. These tools provide built-in functionality for managing workflows, scaling pipelines, and integrating with container registries and Kubernetes.
- D. Incorrect.
Manually performing the steps is inefficient, error-prone, and not aligned with DevOps principles of automation and scalability.