Thanks a lot! This was the piece I was missing. Although I have already read this page before I didn’t notice that the topology-mode annotation needs to be turned on to make trafficDistribution work.
So, after adding this annotation to the service:
---
apiVersion: v1
kind: Service
metadata:
name: svc-prefer-close
namespace: test
annotations:
service.kubernetes.io/topology-mode: auto
spec:
ports:
- name: http
protocol: TCP
port: 8080
targetPort: 8080
selector:
app: service-traffic-example
type: ClusterIP
trafficDistribution: PreferClose
the load-balancing works as a charm (all of the request are being redirected to single worker pod in my case).
Thanks again!