Skip to content

Instantly share code, notes, and snippets.

@vukasin-nikodijevic
Last active September 16, 2019 07:33
Show Gist options
  • Save vukasin-nikodijevic/2d891001bbefb225114f9a9119886023 to your computer and use it in GitHub Desktop.
Save vukasin-nikodijevic/2d891001bbefb225114f9a9119886023 to your computer and use it in GitHub Desktop.
Enter container's namespace from the worker node

Login into worker node by inspecting pod

$ export WORKER_NODE_IP=$(k describe po <pod_name> | grep "^Node:" | cut -f '2' -d '/')
$ ssh "${WORKER_NODE_IP}"

on the worker node

$ export PROCESS_PID=$(docker inspect --format '{{ .State.Pid }}' <id|name>)

$ nsenter -t $PROCESS_PID -n <command_from_worker_node>

Examples:

Golang apps runtime

Those containers are tipically 3-5MB size just enought to run GO app. In order to debug connectivity at least CURL is required. Package manager isn't part of the image, kubectl exec to any shell will not as well.

From worker host is possible to enter name space of PID running GO app and execute CURL:

$ nsenter -t 34847 -n curl some.pod.svc.cluster.local
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment