cloud-foundation-fabric/blueprints/gke/patterns/redis-cluster/README.md

3.8 KiB

Highly Available Redis Cluster on GKE

Introduction

This blueprint shows how to deploy a highly available Redis cluster on GKE following Google's recommended practices for creating a stateful application.

Requirements

This blueprint assumes the GKE cluster already exists. We recommend using the accompanying Autopilot Cluster Pattern to deploy a cluster according to Google's best practices. Once you have the cluster up-and-running, you can use this blueprint to deploy Kueue in it.

Cluster authentication

Once you have a cluster with, create a terraform.tfvars and setup the credentials_config variable. We recommend using Anthos Fleet to simplify accessing the control plane.

Redis Cluster Configuration

This template exposes several variables to configure the Redis cluster:

  • namespace which controls the namespace used to deploy the Redis instances
  • image to change the container image used by the Redis cluster. Defaults to redis:6.2 (i.e. the official Redis image, version 6.2)
  • stateful_config to customize the configuration of the Redis' stateful set configuration. The default configuration deploys a 6-node cluster with requests for 1 CPU, 1Gi of RAM and a 10Gi volume.

Any other configuration can be applied by directly modifying the YAML manifests under the manifest-templates directory.

Sample Configuration

The following template as a starting point for your terraform.tfvars

credentials_config = {
  kubeconfig = {
    path = "~/.kube/config"
  }
}
statefulset_config = {
  replicas = 8
  resource_requests = {
    cpo    = "2"
    memory = "2Gi"
  }
}

Variables

name description type required default
credentials_config Configure how Terraform authenticates to the cluster. object({…})
image Container image to use. string "redis:6.2"
namespace Namespace used for Redis cluster resources. string "redis"
statefulset_config Configure Redis cluster statefulset parameters. object({…}) {}
templates_path Path where manifest templates will be read from. Set to null to use the default manifests. string null