Skip to content

Add Keycloak pre-Stop hook #2289

@slaskawi

Description

@slaskawi

Summary

When performing Keycloak load testing, it turned out the Keycloak Kubernetes Service emits occasional HTTP 503 even if there is enough Pods to serve the traffic.

This thread highlights that this might be a manifestation of the Kubernetes Proxy design choices and adding a pre-Stop hook might solve it.

After performing some testing, indeed we can see the improvement.

Implementation details:

  1. Add the pre-stop hook to the Keycloak StatefulSet:
154         lifecycle:
155           preStop:
156             exec:
157               command:
158               - /usr/bin/bash
159               - -c
160               - sleep 1
  1. Ensure that it works by invoking:
  • [Terminal 1] siege -l siege.log https://sso.uds.dev
  • [Terminal 2] kubectl rollout restart statefulset -n keycloak keycloak

Aim at 100% availability

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions