Redis
Aiven for RedisĀ®* is a fully managed in-memory NoSQL database that you can deploy in the cloud of your choice to store and access data quickly and efficiently.
Note
Before going through this guide, make sure you have a Kubernetes cluster with the operator installed (see instructions for helm or kubectl), and a Kubernetes Secret with an Aiven authentication token.
Create a Redis instance¶
1. Create a file named redis-sample.yaml
, and add the following content:
apiVersion: aiven.io/v1alpha1
kind: Redis
metadata:
name: redis-sample
spec:
# gets the authentication token from the `aiven-token` Secret
authSecretRef:
name: aiven-token
key: token
# outputs the Redis connection on the `redis-secret` Secret
connInfoSecretTarget:
name: redis-secret
# add your Project name here
project: PROJECT_NAME
# cloud provider and plan of your choice
# you can check all of the possibilities here https://aiven.io/pricing
cloudName: google-europe-west1
plan: startup-4
# general Aiven configuration
maintenanceWindowDow: friday
maintenanceWindowTime: 23:00:00
# specific Redis configuration
userConfig:
redis_maxmemory_policy: "allkeys-random"
2. Create the service by applying the configuration:
3. Review the resource you created with this command:
The output is similar to the following:
...
Status:
Conditions:
Last Transition Time: 2023-01-19T14:48:59Z
Message: Successfully created or updated the instance in Aiven
Reason: Created
Status: True
Type: Initialized
Last Transition Time: 2023-01-19T14:48:59Z
Message: Successfully created or updated the instance in Aiven, status remains unknown
Reason: Created
Status: Unknown
Type: Running
State: REBUILDING
...
The resource will be in the REBUILDING
state for a few minutes. Once the state changes to RUNNING
, you can access the resource.
Use the connection Secret¶
For your convenience, the operator automatically stores the Redis connection information in a Secret created with the
name specified on the connInfoSecretTarget
field.
To view the details of the Secret, use the following command:
The output is similar to the following:
Name: redis-secret
Namespace: default
Labels: <none>
Annotations: <none>
Type: Opaque
Data
====
SSL: 8 bytes
USER: 7 bytes
HOST: 60 bytes
PASSWORD: 24 bytes
PORT: 5 bytes
You can use the jq to quickly decode the Secret:
The output is similar to the following: