Answers: <p>Some clarification first, 
  the <code>ClusterIP</code> is only accessible inside the cluster this is not the right choice to solve your problem and the <code>LoadBalancer</code> depends on the integration with your network, real or virtual, to generate the correct resources and assign an IP address.</p>
  
  <p>With that said, an easy way open a service port should be to use services of type <code>NodePort</code> 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.</p>
  
  <p>You have more info about <code>NodePort</code> on the official Kubernetes documentation <a href="https://kubernetes.io/docs/concepts/services-networking/service/#nodeport" rel="nofollow noreferrer">here</a></p>
  
  <p><strong>UPDATED</strong></p>
  
  <p>As per the last comments, for the use case, the use of <code>NodePort</code> should work and probably is a good option to use some DNS management like <a href="https://github.com/kubernetes-sigs/external-dns" rel="nofollow noreferrer">external-dns</a> to not worry about how to setup the right IP.</p>
  
Answers: CC BY-SA 4.0
Answers: 2020-01-28T09:39:52.123Z
Answers: 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).
Answers: AESthetix256
Answers: CC BY-SA 4.0
Answers: 2020-01-28T15:19:15.583Z
Answers: I've updated my answer with the new information.
Answers: wolmi
Answers: CC BY-SA 4.0
Answers: 2020-01-28T09:26:42.767Z
Answers: 2020-01-28T15:18:52.487Z
Answers: 2020-01-28T15:18:52.487Z
Answers: wolmi
Body: <p>Ok, let's assume I've got the following theoretical setup:</p>
  
  <p><a href="https://i.sstatic.net/jYBe9.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/jYBe9.png" alt="1"></a></p>
  
  <p>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</p>
  
  <p>My first thought was to create <code>ClusterIPs</code> 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.</p>
  
  <p>My next step was to look at <code>LoadBalancer</code>-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.</p>
  
  <p>Any input would be appreciated.</p>
  
Tags: <kubernetes><networking>
Title: Kubernetes: How to expose a Pod/Deployment to the Nodes Network
UserDisplayName: AESthetix256
ThreadText: # Kubernetes: How to expose a Pod/Deployment to the Nodes Network
  
  (Asked by: username_0 on 2020-01-28)
  
  Ok, let's assume I've got the following theoretical setup:
  
  [![1](https://i.sstatic.net/jYBe9.png)](https://i.sstatic.net/jYBe9.png)
  
  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.
  
  **Tags:** kubernetes, networking
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-01-28. Score: 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](https://kubernetes.io/docs/concepts/services-networking/service/#nodeport)
  
  **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](https://github.com/kubernetes-sigs/external-dns) to not worry about how to setup the right IP.
  
  > **Comments:**
  > **username_0**: 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).  
  > **username_1**: I've updated my answer with the new information.  
  
  ---
  
  