Exposing Ports Outside the Kubernetes Cluster
Learn the fast and consistent way to get around a potentially confusing setup of exporting cluster ports.
Join the DZone community and get the full member experience.Join For Free
so there is a ton of documentation out there on kubernetes and how to expose ports outside the cluster. perhaps i was having an issues interpreting the docs but i struggled for a long time with this. no matter what i did i found that i could get to the pod as long as i was inside the cluster (vagrant ssh minion-1) but could not get it from my browser.
after a lot of spinning i finally got this figured out; this article is to help others replicate it. the key was using nodeport value in the configuration, along with the node ip address, to reach into the pod from outside the cluster. this means setting ‘type: nodeport’ in your configuration then using the nodeport assigned with the ip address of the node to access: ‘http://10.245.1.3:30892/’.
here's an image to help clarify:
Published at DZone with permission of Jason McDonald, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.