# Keycloak 17 Container with DNS Ping Clustering

**URL:** <https://forum.keycloak.org/t/keycloak-17-container-with-dns-ping-clustering/14010>\
**Category:** Configuring the server\
**Created:** [March 3, 2022, 5:09pm UTC](https://forum.keycloak.org/t/keycloak-17-container-with-dns-ping-clustering/14010 "2022-03-03T17:09:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tonyswu](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/tonyswu/32/5207_2.png) [@tonyswu](https://forum.keycloak.org/u/tonyswu)\
**Post date:** [March 3, 2022, 5:09pm UTC](https://forum.keycloak.org/t/keycloak-17-container-with-dns-ping-clustering/14010/1 "2022-03-03T17:09:18Z")

</div>

Hi,

Does anyone have documentation on how to configure clustering for Keycloak 17 running in Docker container? I am specifically interested in using DNS ping. Previously in version 15 I was doing this:

```auto
docker run -d -p 8080:8080 \
    -e JGROUPS_DISCOVERY_PROTOCOL=dns.DNS_PING \
    -e JGROUPS_DISCOVERY_PROPERTIES=dns_query=keycloak-ha.not-a-real-domain.net \
    -e CACHE_OWNERS_COUNT=1 \
    jboss/keycloak

```

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![xgp](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/xgp/32/2589_2.png) [@xgp](https://forum.keycloak.org/u/xgp)\
**Post date:** [March 3, 2022, 6:24pm UTC](https://forum.keycloak.org/t/keycloak-17-container-with-dns-ping-clustering/14010/2 "2022-03-03T18:24:12Z")

</div>

JGroups discovery protocol was one of the things that changed quite a bit in the new distribution. See the new guide here: [Keycloak - Server - Configuring distributed caches](https://www.keycloak.org/server/caching)

If you end up needing to write your own Infinispan config file, there a discussion here about it. Even though JDBC\_PING is discussed, you can use the same method for any custom configuration: [Use of JDBC\_PING with Keycloak 17 (Quarkus distro)](http://forum.keycloak.org/t/use-of-jdbc-ping-with-keycloak-17-quarkus-distro/13571)

---

<div class="post-metadata">

**Author:** ![nishada](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/nishada/32/7504_2.png) [@nishada](https://forum.keycloak.org/u/nishada)\
**Post date:** [April 13, 2022, 1:28pm UTC](https://forum.keycloak.org/t/keycloak-17-container-with-dns-ping-clustering/14010/3 "2022-04-13T13:28:08Z")

</div>

If you are trying to create the cluster on Kubernetes, the below properties will help you.

–auto-build  
–cache-stack=kubernetes  
…

A headless Kubernetes service should be created pointing to the Keycloak pod set and its DNS name should be set as an environment variable by name ‘jgroups.dns.query’.

For example:  
env:

- name: jgroups.dns.query  
value: headless-keycloak-service.my-namespace.svc.cluster.local
