1

Ok, let's assume I've got the following theoretical setup:

1

I want to somehow assign IP-Addresses accessible by the PCs on the left to my pods. I can set routes etc. as I need since this setup is purely for practice. My goal is for every Pod to be able to expose any service (HTTP(s)/FTP/...) on any port. E.g.: :22, :22 for SSH

My first thought was to create ClusterIPs for every pod and somehow use ingress to assign IPs to those services, but as I later found out this is not what ingress is intended for.

My next step was to look at LoadBalancer-type services and this is where I'm currently at. My current impression is that they somehow only work with AWS/Google Cloud/Other providers and always expose those selected services to the internet, which is not my intention. I only want them to be accessible from my internal network.

Any input would be appreciated.

1 Answer 1

1

Some clarification first, the ClusterIP is only accessible inside the cluster this is not the right choice to solve your problem and the LoadBalancer depends on the integration with your network, real or virtual, to generate the correct resources and assign an IP address.

With that said, an easy way open a service port should be to use services of type NodePort it assigns a port directly on the machine, the same way you do when you open ports on a Linux machine, but with the difference that all the process is managed by Kubernetes. In that scenario, you only need to worry about the routes between the networks managed on your router.

You have more info about NodePort on the official Kubernetes documentation here

UPDATED

As per the last comments, for the use case, the use of NodePort should work and probably is a good option to use some DNS management like external-dns to not worry about how to setup the right IP.

2
  • Thanks for answering first of all! What I haven't mentioned yet is that I later want to use dns to assign subdomains to pods. pod1.ex.com -> 172.16.0.10 etc., ssh was only used as an example. If it only was about http/s I could use the nginx ingress but I want to be able to access certain services on their default port e.g.: My users should be able to ssh into pod1.ex.com and pod2.ex.com without requiring them to specify a port (or open a ftp connection/whatever I later come up with). Jan 28, 2020 at 9:39
  • I've updated my answer with the new information.
    – wolmi
    Jan 28, 2020 at 15:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.