1

I know that containers in a Pod can share data with each other via shared memory.   But, i have not found a way to use shared memory between Pods.

Is it possible by enabling HostIPC in Pod Security Policies?

Of course, i know that this setting is not recommended for security reasons.

  • Did @Wytrzymały Wiktor answer help you to solve your problem?If yes,Please consider accepting and upvoting it. [What should I do when someone answers my question](https://stackoverflow.com/help/someone-answers)? – Fariya Rahmat Apr 02 '22 at 06:18

1 Answers1

0

Yes, you can use shared memory by setting hostIPC: true in the Pod Security Policy:

hostIPC - Use the host’s ipc namespace. Optional: Default to false.

Notice that you can't link 2 isolated Pods (Pods not allocated on the same Node) IPC spaces together but any hostIPC Pod would be able to use shared memory with any other hostIPC Pod.

You can make sure that the Pods are scheduled together by using nodeSelector or Affinity and anti-affinity.

Bear in ind that you also need to use a proper volume type. For example emptydir will not work but hostPath can be used.

I know you mentioned that but I need to underline the fact that by using the hostIPC you give ability to access data used by any pods that also use the host’s IPC namespace which creates a severe security risk. Here are some examples of it.