Create a Redis service
Apply the following object on your namespace, as specified by its YAML description.
Example to create a Redis instance
apiVersion: vshn.appcat.vshn.io/v1
kind: VSHNRedis
metadata:
name: redis-app1-prod (1)
namespace: prod-app (2)
spec:
parameters:
service:
version: "7.0" (3)
redisSettings: | (4)
activedefrag yes
size: (5)
plan: standard-2
writeConnectionSecretToRef:
name: redis-creds (6)
yaml
1 | Instance name |
2 | The namespace where the object will be created |
3 | Redis version |
4 | Specify custom Redis settings [optional] |
5 | Size of the Redis instance. See Plans and Sizing for more information. |
6 | Secret where the connection details are provisioned. This secret shouldn’t exist before creation. |
To get more information about all available configuration options, please see the API Reference |
Inspect your new Redis service
$ oc get vshnredis.vshn.appcat.vshn.io NAME SYNCED READY CONNECTION-SECRET AGE redis-app1-prod True True redis-creds 3m32s
bash
When you see True
in the READY column, it means the instance is provisioned and ready to use.
Find the connection details
The connection details are stored in a secret. You can retrieve them with the following command:
$ oc get secrets redis-creds -o yaml
bash
The output of the command above is a secret specification with the following structure:
apiVersion: v1
kind: Secret
metadata:
name: redis-creds
stringData:
REDIS_HOST: my-redis-example.my-cloud.com (1)
REDIS_PASSWORD: my-secret (2)
REDIS_PORT: 21700 (3)
REDIS_URL: rediss://default:my-secret@my-redis-example.my-cloud.com:21700 (4)
REDIS_USERNAME: default (5)
ca.crt: base64encoded(data) (6)
tls.crt: base64encoded(data) (7)
tls.key: base64encoded(data) (8)
yaml
1 | Host to connect to |
2 | Password |
3 | Port to use |
4 | URL containing all necessary information to connect to the instance |
5 | Username |
6 | CA certificate to use when TLS is enabled |
7 | Certificate to use when TLS is enabled |
8 | Key to use when TLS is enabled |
Not all fields apply to all providers |