0

Is it somehow possible to share the processes or even the whole namespace between two containers that live in different pods?

The use case is, one pod is part of StatefulSet, and the other pod is part of Job. The job should execute some commands to seed some data in the StatefulSet (and those commands should be executed locally on the first pod).

Mohammed Noureldin
  • 14,913
  • 17
  • 70
  • 99
  • 1
    I'd expect you to normally be able to interact with your stateful service over some sort of network API. You can't normally "execute some commands inside another container" in Kubernetes or other container systems. On the more specific technical question, the two Pods aren't guaranteed to be on the same node which makes it pretty much impossible to share namespaces. – David Maze Oct 02 '22 at 10:38
  • @DavidMaze thank you for your reply. Actually network API exists (I am talking concretely about `samba-tool`). However, accessing the API can happen only by passing Admin Password (a very important centralized password) (or storing it in a secret). Passing it manually will break the automation of cluster provisioning, and I also want to avoid storing this very sensitive password in plain-text. Thus calling the commands locally was my only choice, as it eliminates the need of authentication. – Mohammed Noureldin Oct 02 '22 at 11:47
  • Then you want to run those tasks with some `kubectl exec`, executing commands from your statefulsets pod directly. There is a way to disable PID isolation, it's not what you want (hostPID=true). with proper RBAC, you should be able to have your job kubectl exec into your statefulset running commands. – SYN Oct 02 '22 at 12:34

0 Answers0