<p>I am trying to implement some cookie-based session stickiness with HAProxy inside of K8S cluster. I am using 2.0.2-alpine image.</p>

<p>In this environment I have 10 pods (all alive and ready) of some dummy web application StatefulSet, and HAProxy is pointed to their service by the following back-end:</p>

<pre><code>backend within_session
  log global
  mode http
  option log-health-checks
  option httpchk GET /isalive
  balance roundrobin
  dynamic-cookie-key XXXXX
  cookie SESSION_COOKIE rewrite nocache dynamic
  option httpclose
  server-template srv 10 _http._tcp.dummywebapplication-service.mynamespace.svc.cluster.local resolvers k8s check
</code></pre>

<p>Although I set "srv" to maximum of 10 and I have 10 pods running, HAProxy created only 4 "srv"s.</p>

<p>Do have idea what could cause it?</p>

<p>Here are the relevant HAProxy logs:</p>

<pre><code>&lt;133&gt;Jul 23 08:09:04 haproxy[7]: within_session/srv1 changed its FQDN from (null) to dummywebapplication-0.dummywebapplication-service.mynamespace.svc.cluster.local by 'SRV record'
&lt;133&gt;Jul 23 08:09:54 haproxy[7]: within_session/srv2 changed its FQDN from (null) to dummywebapplication-1.dummywebapplication-service.mynamespace.svc.cluster.local by 'SRV record'
&lt;133&gt;Jul 23 08:10:24 haproxy[7]: within_session/srv3 changed its FQDN from (null) to dummywebapplication-2.dummywebapplication-service.mynamespace.svc.cluster.local by 'SRV record'
&lt;133&gt;Jul 23 08:11:14 haproxy[7]: within_session/srv4 changed its FQDN from (null) to dummywebapplication-3.dummywebapplication-service.mynamespace.svc.cluster.local by 'SRV record'
&lt;133&gt;Jul 23 08:11:54 haproxy[7]: within_session/srv3 changed its FQDN from (null) to dummywebapplication-4.dummywebapplication-service.mynamespace.svc.cluster.local by 'SRV record'
&lt;133&gt;Jul 23 08:13:14 haproxy[7]: within_session/srv2 changed its FQDN from (null) to dummywebapplication-6.dummywebapplication-service.mynamespace.svc.cluster.local by 'SRV record'
&lt;133&gt;Jul 23 08:14:44 haproxy[7]: within_session/srv2 changed its FQDN from (null) to dummywebapplication-8.dummywebapplication-service.mynamespace.svc.cluster.local by 'SRV record'
&lt;133&gt;Jul 23 08:20:04 haproxy[7]: within_session/srv1 changed its FQDN from (null) to dummywebapplication-6.dummywebapplication-service.mynamespace.svc.cluster.local by 'SRV record'
&lt;133&gt;Jul 23 08:20:04 haproxy[7]: within_session/srv2 changed its FQDN from (null) to dummywebapplication-1.dummywebapplication-service.mynamespace.svc.cluster.local by 'SRV record'
&lt;133&gt;Jul 23 08:20:04 haproxy[7]: within_session/srv3 changed its FQDN from (null) to dummywebapplication-5.dummywebapplication-service.mynamespace.svc.cluster.local by 'SRV record'
</code></pre>

<p>Consider that the first 4 lines has srv1-4, and after that the srv ids was reused.</p>

<p>Adding <code>accepted_payload_size 8192</code> to the "revolvers" was fix that issue.</p>
