K8GB with Google Cloud DNS - Example¶
This example demonstrates how to configure K8GB with Google Cloud DNS across two GKE clusters in different regions.
📖 For detailed setup instructions, architecture explanation, and troubleshooting, see Google Cloud DNS Provider Documentation
Quick Overview¶
This example deploys K8GB across two GKE clusters:
- Primary cluster: europe-west1
(failover primary)
- Secondary cluster: us-central1
(failover secondary)
- DNS Zone: gcp-test.k8gb.io
(load-balanced zone hosted by CoreDNS)
- Parent Zone: k8gb.io
(Cloud DNS managed zone for delegation)
Prerequisites¶
- Two GKE clusters in different regions with Workload Identity enabled
- A Cloud DNS managed zone (see provider_gcp.md - Prerequisites)
- Service account with
roles/dns.admin
(see provider_gcp.md - Authentication)
Deployment¶
-
Deploy K8GB on the first cluster:
-
Deploy K8GB on the second cluster:
-
Deploy test application and GSLB resources:
# Create test namespace (do this on both clusters) kubectl apply -f ../../../deploy/crds/test-namespace-ingress.yaml # Deploy podinfo via Helm (do this on both clusters) helm repo add podinfo https://stefanprodan.github.io/podinfo helm upgrade --install frontend --namespace test-gslb \ -f ../../../deploy/test-apps/podinfo/podinfo-values.yaml \ --set ui.message="$(kubectl config current-context)" \ podinfo/podinfo --version 6.9.2 # Apply GSLB configurations (do this on both clusters) kubectl apply -f test-gslb-failover.yaml kubectl apply -f test-gslb-roundrobin.yaml
Configuration Files¶
This example includes:
- k8gb-cluster-gcp-europe-west1.yaml
- Configuration for EU cluster
- k8gb-cluster-gcp-us-central1.yaml
- Configuration for US cluster
- test-gslb-failover.yaml
- Failover strategy example
- test-gslb-roundrobin.yaml
- Round-robin strategy example
Key Configuration Notes¶
- Workload Identity: Configured by default in the example YAML files
- Static Credentials: Commented out alternative (uncomment env/volumes sections if needed)
- Cross-Project Setup: Use
extraArgs.google-project
if DNS zone is in a different project - Geo Tags: Must be unique per cluster (
europe-west1
,us-central1
) - TXT Ownership: Each cluster needs unique
txtPrefix
andtxtOwnerId
See provider_gcp.md for detailed configuration parameters.
Verification¶
# Check K8GB status
kubectl get gslb -n test-gslb
kubectl describe gslb test-gslb-failover -n test-gslb
# Verify NS delegation records in Cloud DNS
gcloud dns record-sets list --zone="k8gb-io" --filter="name~'gcp-test.k8gb.io'"
# Test DNS resolution
nslookup failover.gcp-test.k8gb.io 8.8.8.8
nslookup roundrobin.gcp-test.k8gb.io 8.8.8.8
For detailed verification steps and troubleshooting, see: - Verification - Troubleshooting
Testing Failover¶
# Scale down the primary cluster application
kubectl scale deployment frontend-podinfo --replicas=0 -n test-gslb
# Wait for health check to detect failure (~30-60 seconds)
# Verify DNS now points to secondary cluster
nslookup failover.gcp-test.k8gb.io 8.8.8.8
Additional Resources¶
- Google Cloud DNS Provider Documentation - Complete reference
- K8GB Introduction - How K8GB works