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.

1

1 Answer 1

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.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.