<p>Rancher 2 provides 4 options in the "Ports" section when deploying a new workload:</p>

<ul>
<li>NodePort</li>
<li>HostPort</li>
<li>Cluster IP</li>
<li>Layer-4 Load Balancer</li>
</ul>

<p>What are the differences? Especially between NodePort, HostPort and Cluster IP?</p>

<p><strong>HostPort (nodes running a pod):</strong> Similiar to docker, this will open a port on the node on which the pod is running (this allows you to open port 80 on the host). This is pretty easy to setup an run, however:</p>

<blockquote>
  <p>Don’t specify a hostPort for a Pod unless it is absolutely necessary. When you bind a Pod to a hostPort, it limits the number of places the Pod can be scheduled, because each  combination must be unique. If you don’t specify the hostIP and protocol explicitly, Kubernetes will use 0.0.0.0 as the default hostIP and TCP as the default protocol.
  <a href="https://kubernetes.io/docs/concepts/configuration/overview/" rel="noreferrer">kubernetes.io</a></p>
</blockquote>

<p><strong>NodePort (On every node):</strong> Is restricted to ports between port 30,000 to ~33,000. This usually only makes sense in combination with an external loadbalancer (in case you want to publish a web-application on port 80)</p>

<blockquote>
  <p>If you explicitly need to expose a Pod’s port on the node, consider using a NodePort Service before resorting to hostPort.
  <a href="https://kubernetes.io/docs/concepts/configuration/overview/" rel="noreferrer">kubernetes.io</a></p>
</blockquote>

<p><strong>Cluster IP (Internal only):</strong> As the description says, this will open a port only available for internal applications running in the same <strong>cluster</strong>. A service using this option is accessbile via the internal cluster-ip. </p>
