A software engineering team is designing a CI/CD pipeline using Cloud Build to automate infrastructure updates with Terraform and deploy microservices to a private Google Kubernetes Engine (GKE) cluster. The pipeline needs to read and update Terraform state files stored in a Cloud Storage bucket, interact with the GKE control plane, and execute containerized deployments. To adhere to Google Cloud security best practices and the principle of least privilege, how should the Cloud Build pipeline permissions and network configuration be designed?
- AAssign the primitive Owner role to the Cloud Build service account at the project level to ensure full administrative access to Cloud Storage state files and GKE resources.
- Grant fine-grained roles such as Storage Object Admin on the specific state bucket and Kubernetes Engine Developer on the cluster, while routing Cloud Build traffic through a private worker pool authorized to access the GKE control plane.Cevap
- CGrant the Cloud Build service account the Service Account Admin role across the project so that it can elevate its privileges dynamically during pipeline execution.
- DStore the Terraform state files on local ephemeral disks within the Cloud Build build steps to avoid granting Cloud Storage IAM permissions.
Cevap
Grant fine-grained roles such as Storage Object Admin on the specific state bucket and Kubernetes Engine Developer on the cluster, while routing Cloud Build traffic through a private worker pool authorized to access the GKE control plane.
The solution follows security best practices by assigning minimal, resource-scoped IAM roles (Storage Object Admin on the state bucket and Kubernetes Engine Developer on the cluster) and utilizing Cloud Build Private Pools to securely communicate with the private GKE master endpoint.
Adım Adım Çözüm
Anahtar Kavram
Least-privilege IAM configuration and private network isolation for Cloud Build pipelines interacting with GKE and Cloud Storage