<p>I have a requirement of creating multiple workers in my kubernetes worker cluster which would make http calls to some external services. The workers are invoked using a rule engine. To avoid latency I would want to use a mechanism like unix domain sockets between the rule engine and the workers. I am aware that if I create a PVC I can share volume between the rule engine and the workers. If that is the case can I use domain sockets for communication with the workers. However would autoscaling of workers be handled with this approach</p>

<p>There is no native way to do this in Kubernetes, however you may apply the same approach like the one described in <a href="https://serverfault.com/questions/881875/expose-a-unix-socket-to-the-host-system-from-inside-from-a-docker-container/881895#881895">this</a> Serverfault answer - theoretically should be achievable in K8S too.</p>
<p>Translating it from pure containers way to Kubernetes one, it would required you to simply mount/share the same Persistent Volume with subPath to socket file to all Pods on the same Kubernetes Node. Pick the PV type that allows mounting local storage in RWX access mode.</p>
<p>Known to me limitation: only Pods on the same Node can share the same Unix socket file.</p>
