Enable LDAP authentication for Redis Enterprise for Kubernetes.
| Redis Enterprise for Kubernetes |
|---|
Redis Enterprise Software supports LDAP authentication and authorization through role-based access controls (RBAC). You can map LDAP groups to Redis Enterprise roles to control access to your database and the Cluster Manager UI. For more details on how LDAP works with Redis Enterprise, see LDAP authentication.
Redis Enterprise for Kubernetes supports enabling and configuring LDAP authentication using the RedisEnterpriseCluster (REC) custom resource. Currently, the Redis Enterprise cluster (REC) only supports configuration related to the LDAP server, such as server addresses, connection details, credentials, and query configuration.
To map LDAP groups to Redis Enterprise access control roles, you'll need to use the Redis Enterprise API or admin console.
To enable LDAP for your REC, use the .spec.ldap field in the RedisEnterpriseCluster custom resource.
The following RedisEnterpriseCluster example resource enables a basic LDAP configuration:
apiVersion:app.redislabs.com/v1kind:RedisEnterpriseClustermetadata:name:recspec:nodes:3ldap:protocol:LDAPservers:- host:openldap.openldap.svcport:389bindCredentialsSecretName:ldap-bind-credentialscacheTTLSeconds:600enabledForControlPlane:trueenabledForDataPlane:trueauthenticationQuery:template:cn=%u,ou=default,dc=example,dc=orgauthorizationQuery:attribute:memberOfRefer to the RedisEnterpriseCluster API reference for full details on the available fields.
For LDAP servers that require authentication for client queries, store the bind credentials in a secret and reference them in the RedisEnterpriseCluster custom resource.
Create a secret to store the bind credentials.
kubectl -n <rec-namespace> create secret generic <bind-secret-name> \
--from-literal=dn='<disinguished-name>' \
--from-literal=password=<password>
The secret must:
RedisEnterpriseCluster custom resource.dn key with the distinguished name for the user performing the query (such as cn=admin,dc=example,dc=org).password key with the bind password.Replace the <placeholders> in the command above with your own values.
Reference the secret name in the .spec.ldap.bindCredentialsSecretName field of the RedisEnterpriseCluster custom resource.
spec:ldap:bindCredentialsSecretName:<bind-secret-name>In addition to plain LDAP protocol, Redis Enterprise Software also supports LDAPS and STARTTLS protocols for secure communication with the LDAP server.
To enable one of these protocols, edit the spec.ldap.protocol field in the RedisEnterpriseCluster custom resource:
LDAPS
spec:ldap:protocol:LDAPSDefault port: 636
STARTTLS
spec:ldap:protocol:STARTTLSDefault port: 389
To use a custom CA certificate for validating the LDAP server certificate, store the CA certificate in a secret and reference the secret in the RedisEnterpriseCluster custom resource.
Create a secret to hold the CA certificate.
kubectl -n <rec-namespace> create secret generic <ca-secret-name> \
--from-file=cert=<ca-cert>.pem
The secret must:
RedisEnterpriseCluster custom resource.cert key with a PEM-encoded CA certificate (such as cacert.pem).Replace the <placeholders> in the command above with your own values.
Reference the secret name in the spec.ldap.caCertificateSecretName field of the RedisEnterpriseCluster custom resource.
spec:ldap:caCertificateSecretName:<ca-secret-name>To use an LDAP client certificate, store the certificate in a secret and reference the secret in the RedisEnterpriseCluster custom resource.
Create a secret to hold the client certificate.
kubectl -n <rec-namespace> create secret generic <client-secret-name> \
--from-literal=name=ldap_client \
--from-file=certificate=<client-cert-file> \
--from-file=key=<private-key-file>
The secret must:
RedisEnterpriseCluster custom resource.name key explicitly set to ldap_client.certificate key for the public key (such as cert.pem).key key for the private key (such as key.pem).Replace the <placeholders> in the command above with your own values.
Reference the secret name in the .spec.certificates.ldapClientCertificateSecretName field of the RedisEnterpriseCluster custom resource, substituting your own values for <placeholders>.
spec:certificates:ldapClientCertificateSecretName:<client-secret-name>Redis Enterprise Software can't resolve DNS names with a .local suffix.
If your LDAP server is in the same Kubernetes cluster and exposed via a Service object, avoid addresses such as openldap.openldap.svc.cluster.local. Instead, use short-form addresses such as openldap.openldap.svc.
To map LDAP groups to Redis Enterprise access control roles, you'll need to use the Redis Enterprise API or admin console.
For more details on how LDAP works with Redis Enterprise, see LDAP authentication.