I'm doing a load test with python Locust package on an service API that's running on Kubernetes.
I saw in the source code that the HttpUser uses requests.session.request() to send the requests. By default requests.session keeps the connection alive (which causes all the requests going to one pod instead of getting distributed across all pods on Kubernetes). Only way I know to close the connection after each request is setting connection: close when initializing the requests.session, which is abstracted away from me in Locust.
I tried adding headers={'connection':'close'} in the request call but that didn't do the trick. All requests still goes to the same pod. Anyone know how I can change this setting at runtime?