Google Professional Cloud Developer Question 341
Single answerGoogle Cloud PlatformYou are tasked with deploying a containerized application to Google Kubernetes Engine (GKE) directly from its source code repository. The source code is stored in a private GitHub repository. You want to minimize manual steps and ensure the deployment process is automated and reproducible. Which approach should you take?
- A
Use Google Cloud Build to build the container image directly from the GitHub repository, push it to Google Container Registry (GCR), and deploy it to GKE using a deployment pipeline.
- B
Manually build the container image on your local machine, push the image to Google Container Registry (GCR), and deploy it to GKE using kubectl commands.
- C
Use Google Cloud Run's source-based deployment feature to deploy the application directly from the GitHub repository to GKE.
- D
Clone the repository to a Compute Engine instance, build the container image on the instance, push the image to Google Container Registry (GCR), and deploy it to GKE using kubectl commands.
Show answer and explanation
Correct answer: A
Explanation
Using Google Cloud Build to automate the process is the most efficient and reliable method for deploying applications from source code. It integrates well with GitHub for source control and GKE for containerized application deployment, ensuring a streamlined and reproducible deployment pipeline.
- A. Correct.
This is the correct approach as it leverages Google Cloud Build to automate the process of building, pushing, and deploying the application in a reproducible manner. It integrates seamlessly with GitHub and GKE.
- B. Incorrect.
This is not the best approach because it involves manual steps that are error-prone and less reproducible. Automation is preferred for deployment pipelines.
- C. Incorrect.
Google Cloud Run is not designed to deploy applications directly to GKE. It is used for deploying serverless containerized applications, not managing Kubernetes clusters.
- D. Incorrect.
While this approach might work, it is not recommended as it requires manual setup and lacks the automation and scalability provided by Google Cloud Build.