Skip to main content
Version: 3.0.0-alpha (Diátaxis)

How to vertically scale Redis

This guide explains how to adjust the CPU, memory, and storage resources of your Redis instance on Hikube, either via a predefined preset or by defining explicit values.

Prerequisites

  • A Redis instance deployed on Hikube (see the quick start)
  • kubectl configured to interact with the Hikube API
  • The YAML configuration file for your Redis instance

Steps

1. Check current resources

Review the current configuration of your Redis instance:

kubectl get redis my-redis -o yaml

Note the values of resourcesPreset, resources, replicas and size in the spec section.

2. Option A: Modify the resourcesPreset

The simplest way to scale is to use a predefined preset. Here are the available presets:

PresetCPUMemory
nano250m128Mi
micro500m256Mi
small1512Mi
medium11Gi
large22Gi
xlarge44Gi
2xlarge88Gi

For example, to go from nano to medium:

redis-medium.yaml
apiVersion: apps.cozystack.io/v1alpha1
kind: Redis
metadata:
name: my-redis
spec:
replicas: 2
resourcesPreset: medium
size: 2Gi
authEnabled: true

3. Option B: Define explicit resources

For precise control, specify CPU and memory directly with the resources field:

redis-custom-resources.yaml
apiVersion: apps.cozystack.io/v1alpha1
kind: Redis
metadata:
name: my-redis
spec:
replicas: 2
resources:
cpu: 2000m
memory: 4Gi
size: 5Gi
authEnabled: true
warning

If the resources field is defined, the resourcesPreset value is entirely ignored. Remove resourcesPreset from the manifest to avoid confusion.

4. Adjust the number of replicas if needed

You can also increase the number of replicas to distribute the read load:

redis-scaled.yaml
apiVersion: apps.cozystack.io/v1alpha1
kind: Redis
metadata:
name: my-redis
spec:
replicas: 3
resourcesPreset: large
size: 5Gi
storageClass: replicated
authEnabled: true

5. Apply the update

kubectl apply -f redis-medium.yaml
tip

Redis is an in-memory data store: the allocated memory (resources.memory or that of the preset) must be sufficient to hold your entire dataset. Monitor memory usage before scaling.

Verification

Verify that the resources have been updated:

# Verifier la configuration de la ressource Redis
kubectl get redis my-redis -o yaml | grep -A 5 resources

# Verifier l'etat des pods Redis
kubectl get pods -l app.kubernetes.io/instance=my-redis

Expected output:

NAME              READY   STATUS    RESTARTS   AGE
my-redis-0 1/1 Running 0 2m
my-redis-1 1/1 Running 0 2m

Going further