GKE cluster setup


Overview

This section provides instructions for setting up the Google Kubernetes Engineexternal link (GKE) for use with the CAST Imaging helm charts installation scripts described in Installation on Google Cloud Platform via GKE.

Setup GCP CLI

gcloud init

Create cluster

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

gcloud components install gke-gcloud-auth-plugin
  • Test the cli is working by running: kubectl version --client

Install Helm