Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Where can I find details or examples for creating a real RedisEnterpriseDatabase resource? #189

Open
grtrout opened this issue Sep 3, 2021 · 9 comments

Comments

@grtrout
Copy link

grtrout commented Sep 3, 2021

I was hoping that I could create a database in the UI and it would create a RedisEnterpriseDatabase resource that I could learn from, but creating the database in the UI does not create a RedisEnterpriseDatabase resource at all. The examples for RedisEnterpriseDatabase have basically nothing outside of the memorySize specified.

So, where can I find examples of a RedisEnterpriseDatabase resource where things like replication, shards, eviction policy, etc. are specified?

Thanks!

@laurentdroin
Copy link
Contributor

Hi,

Indeed, creating a database in the UI will not create a corresponding REDB Kubernetes resource (the Redis Enterprise Cluster by itself not being aware it is running in a Kubernetes environment).
Note that when a database is created as a REDB resource, the manifest for that resource is the source of truth, and modifications you may make to the database in the UI will be reverted as the REDB controller will constantly try to reconcile the REDB resource specification with the real world.

You can find all the REDB supported properties here: https://github.com/RedisLabs/redis-enterprise-k8s-docs/blob/master/redis_enterprise_database_api.md#redisenterprisedatabasespec

Here is a small example of a REDB definition that makes use of some of these properties:

apiVersion: app.redislabs.com/v1alpha1
kind: RedisEnterpriseDatabase
metadata:
  name: my-custom-db
spec:
  memorySize: 100MB
  replication: true
  persistence: snapshotEvery1Hour
  shardCount: 2
  evictionPolicy: allkeys-lru

I hope this will help.

Cheers,

Laurent.

@grtrout
Copy link
Author

grtrout commented Sep 3, 2021

@laurentdroin Thank you - that is very helpful.

A few comments:

  • I wish the Redis Enterprise Cluster was aware that it was running in a K8s environment. I think the experience would be improved.
  • Even when I create a REDB resource that is ultimately "bad," it still gets created. The only way I know it didn't work is due to its relevant services never being created and/or it not appearing in the UI.
    • E.g.: if I add .spec.backup: {} the REDB is created, but nothing else happens.
  • No events ever seem to get created in my namespace, whether to indicate success or failure.
  • I should be able to create the REDB in a different namespace than where the operator itself is deployed. There seems to be no way to do this.

Finally, and this is just in case it helps anyone else, here is the YAML I settled on using:

apiVersion: app.redislabs.com/v1alpha1
kind: RedisEnterpriseDatabase
metadata:
  name: redb-db1
spec:
  alertSettings: {}
  databaseSecretName: "redb-db1-secret"
  defaultUser: false
  evictionPolicy: allkeys-lru
  memorySize: 2GB
  modulesList: []
  ossCluster: false
  persistence: disabled
  proxyPolicy: single
  rackAware: false
  redisEnterpriseCluster:
    name: rec-test
  replication: true
  shardCount: 4
  tlsMode: disabled

@laurentdroin
Copy link
Contributor

Hi @grtrout

There is an admission controller that you can configure and that should help block the REDB creation if the corresponding database cannot be created. The admission controller is now deployed as part of the Operator deployment (in its own container).
See step 5 of https://github.com/RedisLabs/redis-enterprise-k8s-docs#installation and also https://github.com/RedisLabs/redis-enterprise-k8s-docs/tree/master/admission

There is also a way to deploy a REDB resource in a different namespace (which we call "consumer" namespace).
See https://github.com/RedisLabs/redis-enterprise-k8s-docs/tree/master/multi-namespace-redb

Hope this is helpful.

Laurent.

@grtrout
Copy link
Author

grtrout commented Sep 3, 2021

@laurentdroin Excellent! I will check into both the admission controller and the consumer namespace strategy. Thanks for your help.

@grtrout
Copy link
Author

grtrout commented Sep 20, 2021

@laurentdroin - is it possible to configure a RedisEnterpriseDatabase using the RedisEnterpriseDatabaseSpec and not require auth?

@laurentdroin
Copy link
Contributor

@grtrout - Not directly, but you should be able to achieve this by creating a secret with an empty password first and then specifying that secret in the REDB manifest before the REDB is created.

Something like:
kubectl create secret generic my-password --from-literal=password=''

and then:

apiVersion: app.redislabs.com/v1alpha1
kind: RedisEnterpriseDatabase
metadata:
  name: my-db
spec:
  databaseSecretName: my-password

I hope this helps.

Laurent.

@grtrout
Copy link
Author

grtrout commented Sep 20, 2021

@laurentdroin Thanks. I was able to get that working, but I ended up just modifying my configmaps to supply the generated password. I was more interested in not having to do this at all for quick testing (and since this is, I believe, how it's set up by default in the web UI).

@grtrout
Copy link
Author

grtrout commented Sep 20, 2021

@laurentdroin - If I want to specify the port where my database is exposed, can that be done via the RedisEnterpriseDatabase resource definition? This is an important feature that I used with the Web UI since it allowed me to declare the port and specify it in the applications' manifests without having to use any sort of find/replace scripting.

@laurentdroin
Copy link
Contributor

@grtrout - It is currently not possible via REDB but we do have a feature request on this in order for this to be implemented in a future version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants