Timeline for Is there a way to get the PID information for the host network namespace?
Current License: CC BY-SA 4.0
7 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| May 28 at 17:00 | comment | added | Stephen Harris | ls -l /proc/*/ns/net will tell you what namespace each PID is in, so you could correlate that data, even if the namespace doesn't have a name. I know docker namespaces are unnamed by default. | |
| May 28 at 16:48 | comment | added | Mikal.Furnell | Yes so what I was doing is identifying the PIDs within the namespace so I could reference them back to the starting PID I gathered from crictl inspect that way I could tie Pod, Container, and Container Image together. This is all for IA documentation as they wanted to see the pieces as they were in use in the system and be able to verify dataflow. | |
| May 28 at 16:40 | comment | added | Stephen Harris | FWIW, you can ask what namespace any PID is in with ip netns identify PID. But by default there isn't a name for the "general" namespace; ip netns identify 1 returns the empty string. You can name it, similar to @muru's command it you want to access it by name. | |
| May 28 at 16:35 | comment | added | Mikal.Furnell | Oh wow thats an awesome easy way to get what I'm looking for thank you! | |
| May 28 at 16:11 | comment | added | muru | It's common to "create" a name for the host network namespace by doing, say, ln -s /proc/1/ns/net /var/run/netns/default, then you can do ip netns pids default | |
| S May 28 at 15:49 | review | First questions | |||
| May 28 at 16:05 | |||||
| S May 28 at 15:49 | history | asked | Mikal.Furnell | CC BY-SA 4.0 |