GKE cluster setup
Overview
This section provides instructions for setting up the Google Kubernetes Engine (GKE) for use with the CAST Imaging helm charts installation scripts described in Installation on Google Cloud Platform via GKE.
Setup GCP CLI
- Install
gcloudCLI, see https://cloud.google.com/sdk/docs/install - Initialize the CLI:
gcloud init
Ensure the account (user or service account) used to run the commands below has the permissions required to create and manage GKE clusters and the associated Compute Engine, networking and IAM resources in your project. Insufficient permissions are the most common cause of failures during cluster creation.
Create cluster
The cluster creation scripts below are provided as a suggested starting point - adapt them to your own requirements. It is recommended to keep all nodes in the same zone to reduce network latency in the communications between CAST Imaging services. This is why the scripts create a zonal cluster pinned to a single zone (--zone) rather than a regional cluster spread across multiple zones.
Linux / macOS
#!/bin/bash
# Set your project ID
PROJECT_ID="your-project-id"
# Set your preferred region or zone
REGION="us-east1"
ZONE="us-east1-b"
# Set your cluster name
CLUSTER_NAME="my-gke-cluster"
# Set the node machine type (8 vCPU / 32 GB RAM)
MACHINE_TYPE="e2-standard-8"
# For 8 vCPU / 64 GB RAM, use a high-memory instance type instead:
# MACHINE_TYPE="e2-highmem-8"
# Configure gcloud to use your project
gcloud config set project $PROJECT_ID
# Create the GKE cluster
gcloud container clusters create $CLUSTER_NAME \
--zone=$ZONE \
--num-nodes=2 \
--machine-type=$MACHINE_TYPE \
--disk-type=pd-standard \
--disk-size=100GB \
--enable-autoscaling \
--min-nodes=2 \
--max-nodes=4 \
--scopes=https://www.googleapis.com/auth/cloud-platform \
--addons=HttpLoadBalancing,GcpFilestoreCsiDriver
# Verify cluster creation
gcloud container clusters list
# Get credentials to interact with the cluster
gcloud container clusters get-credentials $CLUSTER_NAME --zone=$ZONE
# Verify nodes
kubectl get nodes
Windows
REM Set your project ID
set PROJECT_ID=your-project-id
REM Set your preferred region or zone
set REGION=us-east1
set ZONE=us-east1-b
REM Set your cluster name
set CLUSTER_NAME=my-gke-cluster
REM Set the node machine type (8 vCPU / 32 GB RAM)
set MACHINE_TYPE=e2-standard-8
REM For 8 vCPU / 64 GB RAM, use a high-memory instance type instead:
REM set MACHINE_TYPE=e2-highmem-8
REM Configure gcloud to use your project
gcloud config set project %PROJECT_ID%
REM Create the GKE cluster
gcloud container clusters create %CLUSTER_NAME% ^
--zone=%ZONE% ^
--num-nodes=2 ^
--machine-type=%MACHINE_TYPE% ^
--disk-type=pd-standard ^
--disk-size=100GB ^
--enable-autoscaling ^
--min-nodes=2 ^
--max-nodes=4 ^
--scopes=https://www.googleapis.com/auth/cloud-platform ^
--addons=HttpLoadBalancing,GcpFilestoreCsiDriver
REM Verify cluster creation
gcloud container clusters list
REM Get credentials to interact with the cluster
gcloud container clusters get-credentials %CLUSTER_NAME% --zone=%ZONE%
REM Verify nodes
kubectl get nodes
Install kubectl - commandline K8s tool
- Follow the instructions provided here: https://kubernetes.io/docs/tasks/tools/
- Install gke-gcloud-auth-plugin:
gcloud components install gke-gcloud-auth-plugin
- Test the cli is working by running:
kubectl version --client
Install Helm
- Follow the instructions provided here: https://helm.sh/docs/intro/quickstart/ . The binary download is provided here: https://github.com/helm/helm/releases