Keycloak session timeout - Using GCE Ingress on Google Kubernetes Engine

7/15/2019

I have deployed Keycloak Cluster on GKE and exposed its service and everything seems to work fine.

But when I use Ingress on top of GKE LoadBalancer (to use Google managed certificate) my request to keycloak is expiring (everytime I refresh it shows you took too long even for 2-3 seconds).

If I bypass the Ingress (directly use LoadBalancer) then everything works just fine.

Could anyone help me with this, I must use Ingress to keep my application certificate and HTTPS endpoints.

I tested the deployment without ingress and it works fine. The issue arises when we go through ingress (GCE Ingress, not NGINX)

YAML for my GCP Ingress

annotations:
    ingress.gcp.kubernetes.io/pre-shared-cert: mcrt-57dc75f6-27b0-4e5b-b0fe-f7e0d0f39722
    ingress.kubernetes.io/backends: '{"k8s-be-30245--2bec4c1d9af8c155":"HEALTHY"}'
    ingress.kubernetes.io/forwarding-rule: k8s-fw-default-authorization-ingress--2bec4c1d9af8c155
    ingress.kubernetes.io/https-forwarding-rule: k8s-fws-default-authorization-ingress--2bec4c1d9af8c155
    ingress.kubernetes.io/https-target-proxy: k8s-tps-default-authorization-ingress--2bec4c1d9af8c155
    ingress.kubernetes.io/ssl-cert: mcrt-57dc75f6-27b0-4e5b-b0fe-f7e0d0f39722
    ingress.kubernetes.io/target-proxy: k8s-tp-default-authorization-ingress--2bec4c1d9af8c155
    ingress.kubernetes.io/url-map: k8s-um-default-authorization-ingress--2bec4c1d9af8c155
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"extensions/v1beta1","kind":"Ingress","metadata":{"annotations":{"kubernetes.io/ingress.global-static-ip-name":"authorization-ip","networking.gke.io/managed-certificates":"authorization-ip"},"name":"authorization-ingress","namespace":"default"},"spec":{"backend":{"serviceName":"authorization-service","servicePort":80}}}
    kubernetes.io/ingress.global-static-ip-name: authorization-ip
    networking.gke.io/managed-certificates: authorization-ip

\==> Error while refreshing Keycloak Error while refreshing Keycloak

\==> GKE Default Ingress GKE Default Ingress

-- Kumar Vivek
google-cloud-platform
google-kubernetes-engine
keycloak
kubernetes
kubernetes-ingress

0 Answers