I'm trying to improve my security knowledge on containers environments.

Recently I was playing around with Kubernetes cluster. I saw this absolutely awesome link: https://schd.ws/hosted_files/kccncna17/d8/Hacking%20and%20Hardening%20Kubernetes%20By%20Example%20v2.pdf

  • From a compromised container, how can I know the Node IP addresses? Is always the gateway of my compromised container the IP of the node containing it?
  • From a compromised container, how can I know the cluster API IP address?

1 Answer 1


Getting to the Node address from a compromised container can be non-obvious, depending on which Container Network Interface (CNI) plugin is in use.

You can try traceroute from the container and in some cases the first hop will be the node IP address.

Getting to the Cluster API address is generally much simpler. The default in all clusters is to create a service for Kubernetes and to inject the Service IP address into each container as an environment variable. If you look for KUBERNETES_SERVICE_HOST that should show you an IP address you can connect to.

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.