Skip to main content

GCP Configuration Guide

This guide explains how to configure Google Cloud Platform (GCP) settings for CI/CD deployment workflows.

Overview

The deployment workflows (deploy-preview-gke.yaml, deploy-production-gke.yaml) require GCP configuration for:
  • Authentication: Workload Identity Federation (keyless authentication)
  • Resource Access: GKE clusters, Artifact Registry, Cloud Logging
  • Deployment: Kubernetes manifest application via kubectl/Kustomize

Prerequisites

  • GCP project with billing enabled
  • gcloud CLI installed and authenticated
  • Repository admin access to configure GitHub secrets
  • Permissions to create service accounts and configure Workload Identity

Quick Setup (Automated Script)

We provide an automated setup script for convenience:
Script outputs: GitHub secrets ready to paste into repository settings.

Manual Setup

Step 1: Set Environment Variables

Step 2: Enable Required APIs

Step 3: Create Service Account

Step 4: Configure Workload Identity Federation

Step 5: Create GKE Clusters

Staging Cluster

Production Cluster

Step 6: Create Artifact Registry


GitHub Secrets Configuration

Required Secrets

Configure the following secrets in your GitHub repository settings (SettingsSecrets and variablesActions):

How to Get Values


Update Workflow Files

Once secrets are configured, update the workflow files to use them:

deploy-preview-gke.yaml

deploy-production-gke.yaml


Verification

Test Authentication

Test Deployment

Trigger a manual workflow run to test:

Troubleshooting

Common Issues

1. “Permission denied” during deployment

Cause: Service account lacks required permissions. Solution:

2. “Workload Identity Provider not found”

Cause: Incorrect provider path or pool not created. Solution:

3. “Cluster not found”

Cause: Cluster name mismatch or wrong region. Solution:

Security Best Practices

1. Principle of Least Privilege

Grant only necessary permissions:

2. Separate Environments

Use different service accounts for staging vs production:

3. Audit Logging

Enable audit logs for service account activity:

4. Conditional Access

Limit Workload Identity to specific branches:

Cost Optimization

1. Use Preemptible Nodes (Staging)

2. Enable Cluster Autoscaling

Already enabled in cluster creation. Monitor usage:

3. Use Artifact Registry Lifecycle Policies


Monitoring & Alerts

Setup Budget Alerts

View Deployment Logs


Automated Setup Script

Create scripts/setup/configure-gcp-cicd.sh:
Make it executable:

Next Steps

  1. Configure GitHub Secrets - Add all required secrets to repository
  2. Update Workflow Files - Replace hardcoded values with ${{ secrets.* }}
  3. Test Staging Deployment - Trigger manual workflow run
  4. Configure Production - Set up production environment protection
  5. Monitor Costs - Review GCP billing dashboard weekly

References


Last Updated: 2025-11-02 Maintained By: CI/CD Team