|
| 1 | +# Deploying sifnode on Google Kubernetes Engine (GKE) |
| 2 | + |
| 3 | +This guide walks through deploying a sifnode validator on **Google Kubernetes Engine (GKE)**. |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | + |
| 7 | +| Requirement | Version | Install | |
| 8 | +|-------------|---------|---------| |
| 9 | +| gcloud CLI | latest | [Install](https://cloud.google.com/sdk/docs/install) | |
| 10 | +| Terraform | >= 0.13 | [Install](https://learn.hashicorp.com/tutorials/terraform/install-cli) | |
| 11 | +| kubectl | >= 1.18 | `gcloud components install kubectl` | |
| 12 | +| Helm 3 | >= 3.0 | [Install](https://helm.sh/docs/intro/install/) | |
| 13 | + |
| 14 | +## Quick Start |
| 15 | + |
| 16 | +### 1. Authenticate with GCP |
| 17 | + |
| 18 | +```bash |
| 19 | +gcloud auth login |
| 20 | +gcloud config set project YOUR_PROJECT_ID |
| 21 | +``` |
| 22 | + |
| 23 | +### 2. Deploy Infrastructure |
| 24 | + |
| 25 | +```bash |
| 26 | +# Clone the repository |
| 27 | +git clone https://github.com/Sifchain/sifnode.git |
| 28 | +cd sifnode |
| 29 | + |
| 30 | +# Deploy with the automation script |
| 31 | +./deploy/gke/deploy_gke.sh create -p YOUR_PROJECT_ID -r us-central1 |
| 32 | +``` |
| 33 | + |
| 34 | +### 3. Verify Deployment |
| 35 | + |
| 36 | +```bash |
| 37 | +# Check cluster status |
| 38 | +./deploy/gke/deploy_gke.sh status |
| 39 | + |
| 40 | +# Check pod logs |
| 41 | +kubectl logs -n sifnode -l app=sifnode |
| 42 | + |
| 43 | +# Check sifnoded status |
| 44 | +kubectl exec -n sifnode deploy/sifnode -- sifnoded status |
| 45 | +``` |
| 46 | + |
| 47 | +## Manual Deployment (Step by Step) |
| 48 | + |
| 49 | +### Cluster Setup |
| 50 | + |
| 51 | +```bash |
| 52 | +cd deploy/terraform/providers/gke |
| 53 | + |
| 54 | +terraform init |
| 55 | +terraform apply \ |
| 56 | + -var="project_id=YOUR_PROJECT_ID" \ |
| 57 | + -var="region=us-central1" \ |
| 58 | + -var="cluster_name=sifnode-gke" |
| 59 | +``` |
| 60 | + |
| 61 | +### Configure kubectl |
| 62 | + |
| 63 | +```bash |
| 64 | +gcloud container clusters get-credentials sifnode-gke \ |
| 65 | + --region us-central1 \ |
| 66 | + --project YOUR_PROJECT_ID |
| 67 | +``` |
| 68 | + |
| 69 | +### Install sifnode via Helm |
| 70 | + |
| 71 | +```bash |
| 72 | +# Create namespace |
| 73 | +kubectl create namespace sifnode |
| 74 | + |
| 75 | +# Install with GKE-specific values |
| 76 | +helm install sifnode deploy/helm/sifnode \ |
| 77 | + --namespace sifnode \ |
| 78 | + --create-namespace \ |
| 79 | + --values deploy/helm/sifnode/values_gke.yaml \ |
| 80 | + --set provider=gke \ |
| 81 | + --set persistence.storageClass=gke-ssd |
| 82 | + |
| 83 | +# Check deployment |
| 84 | +kubectl get pods -n sifnode -w |
| 85 | +``` |
| 86 | + |
| 87 | +## Configuration Reference |
| 88 | + |
| 89 | +### GKE Terraform Variables |
| 90 | + |
| 91 | +| Variable | Default | Description | |
| 92 | +|----------|---------|-------------| |
| 93 | +| `project_id` | (required) | GCP project ID | |
| 94 | +| `region` | `us-central1` | GCP region | |
| 95 | +| `cluster_name` | (required) | GKE cluster name | |
| 96 | +| `machine_type` | `e2-standard-2` | Node machine type | |
| 97 | +| `desired_capacity` | `1` | Initial node count | |
| 98 | +| `min_capacity` | `1` | Minimum nodes (autoscaling) | |
| 99 | +| `max_capacity` | `5` | Maximum nodes (autoscaling) | |
| 100 | +| `disk_size` | `100` | Node disk size (GB) | |
| 101 | +| `storage_size` | `50Gi` | PVC storage size | |
| 102 | +| `enable_private_nodes` | `false` | Enable private GKE nodes | |
| 103 | +| `release_channel` | `REGULAR` | GKE release channel | |
| 104 | + |
| 105 | +### Helm Values (GKE-specific) |
| 106 | + |
| 107 | +Key settings in `values_gke.yaml`: |
| 108 | + |
| 109 | +```yaml |
| 110 | +provider: gke |
| 111 | +persistence: |
| 112 | + storageClass: gke-ssd # SSD persistent storage |
| 113 | +resources: |
| 114 | + requests: |
| 115 | + cpu: "500m" |
| 116 | + memory: "1Gi" |
| 117 | + limits: |
| 118 | + cpu: "2" |
| 119 | + memory: "4Gi" |
| 120 | +autoscaling: |
| 121 | + enabled: true |
| 122 | +``` |
| 123 | +
|
| 124 | +## Comparison: AWS (EKS) vs GKE |
| 125 | +
|
| 126 | +| Feature | AWS (EKS) | GKE | |
| 127 | +|---------|-----------|-----| |
| 128 | +| Provisioning | Terraform (terraform-aws-modules/eks) | Terraform (google_container_cluster) | |
| 129 | +| Node Type | t2.medium (x86) | e2-standard-2 (x86) | |
| 130 | +| Storage | EBS CSI / EFS CSI | GCE Persistent Disk (pd-ssd) | |
| 131 | +| Networking | VPC + Public Subnets | VPC + Subnet + Cloud NAT | |
| 132 | +| DNS | Route53 (via ExternalDNS) | Cloud DNS | |
| 133 | +| Ingress | ALB Ingress Controller | GCE Ingress | |
| 134 | +| IAM | AWS IAM Roles | GCP IAM + Workload Identity | |
| 135 | +| CLI Profile | AWS_PROFILE | gcloud config | |
| 136 | +
|
| 137 | +## Troubleshooting |
| 138 | +
|
| 139 | +### Pods stuck in Pending state |
| 140 | +```bash |
| 141 | +kubectl describe pod -n sifnode <pod-name> |
| 142 | +# Check for resource constraints or PVC binding issues |
| 143 | +``` |
| 144 | + |
| 145 | +### GKE cluster not reachable |
| 146 | +```bash |
| 147 | +gcloud container clusters get-credentials sifnode-gke --region us-central1 |
| 148 | +# Ensure your gcloud is authenticated |
| 149 | +``` |
| 150 | + |
| 151 | +### Storage issues |
| 152 | +```bash |
| 153 | +kubectl get pvc -n sifnode |
| 154 | +kubectl get storageclass |
| 155 | +# Ensure gke-ssd storage class exists |
| 156 | +``` |
| 157 | + |
| 158 | +## Clean Up |
| 159 | + |
| 160 | +```bash |
| 161 | +# Option 1: Using the deployment script |
| 162 | +./deploy/gke/deploy_gke.sh destroy |
| 163 | + |
| 164 | +# Option 2: Manual |
| 165 | +helm uninstall sifnode --namespace sifnode |
| 166 | +cd deploy/terraform/providers/gke |
| 167 | +terraform destroy -var="project_id=YOUR_PROJECT_ID" |
| 168 | +``` |
| 169 | + |
| 170 | +--- |
| 171 | + |
| 172 | +*For additional assistance, refer to the [sifnode documentation](https://docs.sifchain.finance/).* |
0 commit comments