Repository navigation
Keycloak - ACA deployment (multiple replica session issue) #40316
Replies: 2 comments
|
Did you get any resolution to this? We are running into the same issue and found out that distributed caching just simply is not possible since each replica cannot communicate directly with other replicas to coordinate the cache. I am looking for an aca-based solution but so far running only a single instance seems to be the only working scenario. Running in AKS is not possible for us. |
|
Hello, I came into similar issues when initially tried to deploy Keycloak on Azure Container Apps. But, I managed to resolve them and get it working in HA with a Terraform implementation where Keycloak runs successfully on ACA with autoscaling between 2–5 replicas. The full infrastructure and configuration are available in this repo in case it helps: https://github.com/hoolser/terraform-azurerm-keycloak-aca Some results for the HA testing we performed and verified can be found here: (Additional detailed tests we performed are documented here: Happy to hear feedback if anyone tries this setup. |
Uh oh!
There was an error while loading. Please reload this page.
Hi Team,
I have deployed keycloak v26 inside Azure Container Apps with min-max-replicas = 1. But as soon as I increase the replica count min-max-replicas > 1 it gives issue of session timeout. I am using below command to start keycloak inside ACA
/opt/keycloak/bin/kc.sh start and as per documentation ideally it enables cache ispn to manage and sync user session across replicas using jdbc-ping default cache-stack. But when I checked my console it is enabling the cache ispn but it is using multicast udp stack to communicate with replicas for syncing session which Azure Container Apps not supports. Is there any solution to change that stack ? I tried by adding command /opt/keycloak/bin/kc.sh start --cache-stack=jdbc-ping but it didn't deploy container and also getting error
ERROR [org.infinispan.CONFIG] (ForkJoinPool.commonPool-worker-1) ISPN000660: DefaultCacheManager start failed, stopping any running components: org.infinispan.commons.CacheConfigurationException: ISPN000540: No such JGroups stack 'jdbc-ping'Below is cache-ispn.xml which I found inside my container.
<cache-container name="keycloak"> <transport lock-timeout="60000" stack="udp"/> <local-cache name="realms" simple-cache="true"> <encoding> <key media-type="application/x-java-object"/> <value media-type="application/x-java-object"/> </encoding> <memory max-count="10000"/> </local-cache> <local-cache name="users" simple-cache="true"> <encoding> <key media-type="application/x-java-object"/> <value media-type="application/x-java-object"/> </encoding> <memory max-count="10000"/> </local-cache> <distributed-cache name="sessions" owners="1"> <expiration lifespan="-1"/> <memory max-count="10000"/> </distributed-cache> <distributed-cache name="authenticationSessions" owners="2"> <expiration lifespan="-1"/> </distributed-cache> <distributed-cache name="offlineSessions" owners="1"> <expiration lifespan="-1"/> <memory max-count="10000"/> </distributed-cache> <distributed-cache name="clientSessions" owners="1"> <expiration lifespan="-1"/> <memory max-count="10000"/> </distributed-cache> <distributed-cache name="offlineClientSessions" owners="1"> <expiration lifespan="-1"/> <memory max-count="10000"/> </distributed-cache> <distributed-cache name="loginFailures" owners="2"> <expiration lifespan="-1"/> </distributed-cache> <local-cache name="authorization" simple-cache="true"> <encoding> <key media-type="application/x-java-object"/> <value media-type="application/x-java-object"/> </encoding> <memory max-count="10000"/> </local-cache> <replicated-cache name="work"> <expiration lifespan="-1"/> </replicated-cache> <local-cache name="keys" simple-cache="true"> <encoding> <key media-type="application/x-java-object"/> <value media-type="application/x-java-object"/> </encoding> <expiration max-idle="3600000"/> <memory max-count="1000"/> </local-cache> <distributed-cache name="actionTokens" owners="2"> <encoding> <key media-type="application/x-java-object"/> <value media-type="application/x-java-object"/> </encoding> <expiration max-idle="-1" lifespan="-1" interval="300000"/> <memory max-count="-1"/> </distributed-cache> </cache-container>All reactions