> ## Documentation Index
> Fetch the complete documentation index at: https://mcp-server-langgraph.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# GKE Cluster Requirements for CI/CD

> Prerequisites and setup guide for GKE clusters required by CI/CD deployment workflows

# GKE Cluster Requirements for CI/CD

## Overview

The CI/CD pipeline requires GKE clusters to exist before deployment workflows can succeed. This document outlines the required clusters and how to create them.

## Required Clusters

### Preview Cluster

**Name:** `preview-mcp-server-langgraph-gke`
**Location:** `us-central1`
**Project:** `vishnu-sandbox-20250310`
**Type:** GKE Autopilot (recommended) or Standard

**Creation via Terraform:**

```bash theme={null}
cd terraform/environments/gcp-preview
terraform init
terraform plan
terraform apply
```

**Manual Creation:**

```bash theme={null}
gcloud container clusters create-auto preview-mcp-server-langgraph-gke \
  --region=us-central1 \
  --project=vishnu-sandbox-20250310 \
  --release-channel=regular \
  --enable-master-authorized-networks \
  --network=default \
  --subnetwork=default
```

### Production Cluster

**Name:** `production-mcp-server-langgraph-gke`
**Location:** `us-central1`
**Project:** `vishnu-sandbox-20250310`
**Type:** GKE Autopilot

**Creation via Terraform:**

```bash theme={null}
cd terraform/environments/gcp-prod
terraform init
terraform plan
terraform apply
```

## CI/CD Workflow Dependencies

### deploy-preview-gke.yaml

This workflow requires:

* ✅ GKE cluster: `preview-mcp-server-langgraph-gke` in `us-central1`
* ✅ Service account: `github-actions-preview@vishnu-sandbox-20250310.iam.gserviceaccount.com`
* ✅ Artifact Registry: `mcp-preview` repository
* ✅ GitHub variable: `ENABLE_PREVIEW_AUTODEPLOY=true`

**Workflow Trigger:**

* Push to `main` branch (when `ENABLE_PREVIEW_AUTODEPLOY=true`)
* Manual dispatch

**Current Status:**

* ✅ Cluster created and operational

**Resolution:**
Create the cluster using one of the methods above, then re-run the workflow.

### deploy-production-gke.yaml

This workflow requires:

* ⚠️  GKE cluster: `production-mcp-server-langgraph-gke` in `us-central1`
* ✅ Service account: `github-actions-production@vishnu-sandbox-20250310.iam.gserviceaccount.com`
* ✅ Artifact Registry: `mcp-production` repository

**Workflow Trigger:**

* Manual dispatch (requires approval)
* Release tags

## Verification

After creating clusters, verify they're accessible:

```bash theme={null}
# Verify preview cluster
gcloud container clusters describe preview-mcp-server-langgraph-gke \
  --region=us-central1 \
  --project=vishnu-sandbox-20250310

# Verify production cluster
gcloud container clusters describe production-mcp-server-langgraph-gke \
  --region=us-central1 \
  --project=vishnu-sandbox-20250310

# Test GitHub Actions service account access
gcloud container clusters get-credentials preview-mcp-server-langgraph-gke \
  --region=us-central1 \
  --project=vishnu-sandbox-20250310

kubectl cluster-info
```

## Terraform Module Reference

The GKE Autopilot module is located at:
`terraform/modules/gke-autopilot/`

**Features:**

* Autopilot mode (Google-managed nodes)
* VPC-native networking
* Workload Identity Federation support
* Master authorized networks
* Binary authorization (optional)
* Backup agent integration
* Config Connector support

**Recent Fixes:**

* ✅ Duplicate lifecycle blocks merged (commit b6ac198)
* ✅ Variable validation moved to lifecycle preconditions
* ✅ Terraform validation added to pre-commit hooks

## Troubleshooting

### Error: Cluster not found

**Symptom:**

```yaml theme={null}
Error: NOT_FOUND: projects/vishnu-sandbox-20250310/locations/us-central1/clusters/preview-mcp-server-langgraph-gke not found
```

**Solution:**
The cluster doesn't exist. Create it using the methods above.

### Error: Permission denied

**Symptom:**

```yaml theme={null}
Error: github-actions-preview does not have permission to access cluster
```

**Solution:**
Verify the service account has the `container.developer` role:

```bash theme={null}
gcloud projects get-iam-policy vishnu-sandbox-20250310 \
  --flatten="bindings[].members" \
  --filter="bindings.members:github-actions-preview*"
```

### Error: Artifact Registry repository not found

**Solution:**
Create the Artifact Registry repositories:

```bash theme={null}
# Preview
gcloud artifacts repositories create mcp-preview \
  --repository-format=docker \
  --location=us-central1 \
  --project=vishnu-sandbox-20250310

# Production
gcloud artifacts repositories create mcp-production \
  --repository-format=docker \
  --location=us-central1 \
  --project=vishnu-sandbox-20250310
```

## Auto-Deploy Configuration

The deployment workflows check repository variables to determine if auto-deploy is enabled:

```bash theme={null}
# Enable preview auto-deploy
gh variable set ENABLE_PREVIEW_AUTODEPLOY --body "true"

# Enable dev auto-deploy
gh variable set ENABLE_DEV_AUTODEPLOY --body "true"

# Verify
gh variable list
```

## Related Documentation

* [GKE Autopilot Module](https://github.com/vishnu2kmohan/mcp-server-langgraph/blob/main/terraform/modules/gke-autopilot/README.md)
* [CI/CD Overview](/ci-cd/overview)
* [GitHub Actions WIF Setup](https://github.com/vishnu2kmohan/mcp-server-langgraph/blob/main/terraform/modules/github-actions-wif/README.md)
* [CI/CD Failure Analysis](https://github.com/vishnu2kmohan/mcp-server-langgraph/blob/main/workflow-analysis.md)

## Last Updated

2025-11-04 (Commit: b6ac198)

**Status:**

* Terraform module: ✅ Fixed and validated
* Service accounts: ✅ Created and configured
* Auto-deploy variables: ✅ Set
* GKE clusters: ✅ Created (preview-mcp-server-langgraph-gke)
