# Configure distributed cache with keycloak 18

**URL:** <https://forum.keycloak.org/t/configure-distributed-cache-with-keycloak-18/16058>\
**Category:** Configuring the server\
**Created:** [June 20, 2022, 4:01pm UTC](https://forum.keycloak.org/t/configure-distributed-cache-with-keycloak-18/16058 "2022-06-20T16:01:19Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![arnault](https://avatars.discourse-cdn.com/v4/letter/a/e9c0ed/32.png) [@arnault](https://forum.keycloak.org/u/arnault)\
**Post date:** [June 20, 2022, 4:01pm UTC](https://forum.keycloak.org/t/configure-distributed-cache-with-keycloak-18/16058/1 "2022-06-20T16:01:19Z")

</div>

Hello,

I have been working on migrating keycloak wildfly to keycloak quarkus in a kubernetes environment.  
Currently I’m looking at configuring distributed caches with kubernetes/openshift/rancher.  
In particular I’ve set the environment variable KC\_CACHE\_STACK to kubernetes, and I added the command line argument “-Djgroups.dns.query=headless-service” as explained in the documentation and so far so good.  
Now I’d like to know if this configuration will work with openshift/rancher, does anyone have tested these configurations ?

I’ve been searching on internet, found some interesting posts, but I couldn’t find information pertaining to the problem (in particular I only have a kubernetes cluster to test).

---

<div class="post-metadata">

**Author:** ![weltonrodrigo](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/weltonrodrigo/32/3104_2.png) [@weltonrodrigo](https://forum.keycloak.org/u/weltonrodrigo)\
**Post date:** [June 21, 2022, 10:32am UTC](https://forum.keycloak.org/t/configure-distributed-cache-with-keycloak-18/16058/2 "2022-06-21T10:32:23Z")

</div>

Tested with rancher. Works fine.

---

<div class="post-metadata">

**Author:** ![arnault](https://avatars.discourse-cdn.com/v4/letter/a/e9c0ed/32.png) [@arnault](https://forum.keycloak.org/u/arnault)\
**Post date:** [June 21, 2022, 11:02am UTC](https://forum.keycloak.org/t/configure-distributed-cache-with-keycloak-18/16058/3 "2022-06-21T11:02:18Z")

</div>

Hi, thank you very much for your confirmation.

Regards.

---

<div class="post-metadata">

**Author:** ![arnault](https://avatars.discourse-cdn.com/v4/letter/a/e9c0ed/32.png) [@arnault](https://forum.keycloak.org/u/arnault)\
**Post date:** [June 21, 2022, 12:27pm UTC](https://forum.keycloak.org/t/configure-distributed-cache-with-keycloak-18/16058/4 "2022-06-21T12:27:18Z")

</div>

Hi, anyone can confirm that the configuration works with openshift ?

---

<div class="post-metadata">

**Author:** ![chhaya](https://avatars.discourse-cdn.com/v4/letter/c/b5a626/32.png) [@chhaya](https://forum.keycloak.org/u/chhaya)\
**Post date:** [September 12, 2022, 11:12am UTC](https://forum.keycloak.org/t/configure-distributed-cache-with-keycloak-18/16058/5 "2022-09-12T11:12:13Z")

</div>

Hello I am new with k8s and keycloak. Could you please share how can I get the headless-service-FQDN on k8s?

---

<div class="post-metadata">

**Author:** ![arnault](https://avatars.discourse-cdn.com/v4/letter/a/e9c0ed/32.png) [@arnault](https://forum.keycloak.org/u/arnault)\
**Post date:** [September 13, 2022, 7:25am UTC](https://forum.keycloak.org/t/configure-distributed-cache-with-keycloak-18/16058/6 "2022-09-13T07:25:01Z")

</div>

Answer is not trivial and is worth a global question.

---

<div class="post-metadata">

**Author:** ![weltonrodrigo](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/weltonrodrigo/32/3104_2.png) [@weltonrodrigo](https://forum.keycloak.org/u/weltonrodrigo)\
**Post date:** [September 18, 2022, 2:15pm UTC](https://forum.keycloak.org/t/configure-distributed-cache-with-keycloak-18/16058/7 "2022-09-18T14:15:20Z")

</div>

If you create a headless service called `foo` on namespace `bar`, the FQDN would be `foo.bar.svc.cluster.local`
