Traefik ingress sticky sessions hashed value

3/4/2019

I have Kubernetes cluster with Traefik. And I have a Kubernetes deployment with multiple replicas and an associated Kubernetes service. I have added session affinity to the Kubernetes services:

apiVersion: v1
kind: Service
metadata:
  ...
  annotations:
    traefik.ingress.kubernetes.io/affinity: "true"
    traefik.ingress.kubernetes.io/session-cookie-name: "REPLICA"
spec:
  ...

The session affinity works fine and I can see Traefik creates cookie REPLICA. But the value of that cookie is an internal ip of a replica pod, e.g. http://10.244.2.28:8080. Is it possible to configure Traefik to use some sort of a hash, instead of internal ip address of a pod?

-- Maksim Sorokin
kubernetes
traefik
traefik-ingress

0 Answers