Files
Online-Boutique/kustomize/components/memorystore
Subodh dafcd9777f
Some checks failed
Continuous Integration - Pull Request / code-tests (pull_request) Has been cancelled
Continuous Integration - Pull Request / deployment-tests (local-code) (pull_request) Has been cancelled
helm-chart-ci / helm-chart-ci (pull_request) Has been cancelled
kubevious-manifests-ci / kubevious-manifests-ci (pull_request) Has been cancelled
kustomize-build-ci / kustomize-build-ci (pull_request) Has been cancelled
terraform-validate-ci / terraform-validate-ci (pull_request) Has been cancelled
Clean up deployment / cleanup-namespace (pull_request) Has been cancelled
Continuous Integration - Main/Release / code-tests (push) Has been cancelled
Continuous Integration - Main/Release / deployment-tests (local-code) (push) Has been cancelled
helm-chart-ci / helm-chart-ci (push) Has been cancelled
kubevious-manifests-ci / kubevious-manifests-ci (push) Has been cancelled
kustomize-build-ci / kustomize-build-ci (push) Has been cancelled
terraform-validate-ci / terraform-validate-ci (push) Has been cancelled
Initial commit
2026-02-04 20:47:56 +05:30
..
2026-02-04 20:47:56 +05:30
2026-02-04 20:47:56 +05:30

Integrate Online Boutique with Memorystore (Redis)

By default the cartservice app is serializing the data in an in-cluster Redis database. Using a database outside your GKE cluster could bring more resiliency and more security with a managed service like Google Cloud Memorystore (Redis).

Architecture diagram with Memorystore

Provision a Memorystore (Redis) instance

Important notes:

  • You can connect to a Memorystore (Redis) instance from GKE clusters that are in the same region and use the same network as your instance.
  • You cannot connect to a Memorystore (Redis) instance from a GKE cluster without VPC-native/IP aliasing enabled.

To provision a Memorystore (Redis) instance you can follow the following instructions:

ZONE="<your-GCP-zone>"
REGION="<your-GCP-region>"

gcloud services enable redis.googleapis.com

gcloud redis instances create redis-cart \
    --size=1 \
    --region=${REGION} \
    --zone=${ZONE} \
    --redis-version=redis_7_0

Note: You can also find in this repository the Terraform script to provision the Memorystore (Redis) instance alongside the GKE cluster, more information here.

Deploy Online Boutique connected to a Memorystore (Redis) instance

To automate the deployment of Online Boutique integrated with Memorystore (Redis) you can leverage the following variation with Kustomize.

From the kustomize/ folder at the root level of this repository, execute this command:

kustomize edit add component components/memorystore

Note: this Kustomize component will also remove the redis-cart Deployment and Service not used anymore.

This will update the kustomize/kustomization.yaml file which could be similar to:

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- base
components:
- components/memorystore

Update current Kustomize manifest to target this Memorystore (Redis) instance.

REDIS_IP=$(gcloud redis instances describe redis-cart --region=${REGION} --format='get(host)')
REDIS_PORT=$(gcloud redis instances describe redis-cart --region=${REGION} --format='get(port)')
sed -i "s/REDIS_CONNECTION_STRING/${REDIS_IP}:${REDIS_PORT}/g" components/memorystore/kustomization.yaml

You can locally render these manifests by running kubectl kustomize . as well as deploying them by running kubectl apply -k ..

Resources