Linux capabilities is applied to an executable. If I add capabilities to a container, what does it mean? This is my container securityContext:
securityContext:
runAsUser: 1008
capabilities:
add:
- NET_ADMIN
- NET_RAW
But my task can't create raw socket. So shall I apply capabilities to the executable when packing docker image?
As I have adviced you in comment section, I am posting it as an answer:
See: linux-cap-kubernetes.
Part of your code under container section should look like this:
To run some capabilities (in your case perform various network-related operations) you have to run container as root. See example: capabilities-securitycontext.
Read more: linux-capabilities-securityContext.