diff --git a/content/rancher/v2.x/en/v1.6-migration/expose-services/_index.md b/content/rancher/v2.x/en/v1.6-migration/expose-services/_index.md index 166606948d3..5315469581a 100644 --- a/content/rancher/v2.x/en/v1.6-migration/expose-services/_index.md +++ b/content/rancher/v2.x/en/v1.6-migration/expose-services/_index.md @@ -17,10 +17,10 @@ Use this document to correct workloads that list `ports` in `output.txt`. You ca - [What's Different About Exposing Services in Rancher v2.x?](#what-s-different-about-exposing-services-in-rancher-v2-x) -- [HostPorts](#hostports) -- [Setting HostPorts](#setting-hostports) -- [NodePorts](#nodeports) -- [Setting NodePorts](#setting-nodeports) +- [HostPorts](#hostport) +- [Setting HostPort](#setting-hostport) +- [NodePorts](#nodeport) +- [Setting NodePort](#setting-nodeport) @@ -30,9 +30,9 @@ In Rancher v1.6, we used the term _Port Mapping_ for exposing an IP address and In Rancher v2.x, the mechanisms and terms for service exposure have changed and expanded. You now have two port mapping options: _HostPorts_ (which is most synonymous with v1.6 port mapping, allows you to expose your app at a single IP and port) and _NodePorts_ (which allows you to map ports on _all_ of your cluster nodes, not just one). -Unfortunately, port mapping cannot be parsed by the migration-tools CLI. If the services you're migrating from v1.6 to v2.x have port mappings set, you'll have to either set a [HostPort](#hostports) or [NodePort](#nodeports) as a replacement. +Unfortunately, port mapping cannot be parsed by the migration-tools CLI. If the services you're migrating from v1.6 to v2.x have port mappings set, you'll have to either set a [HostPort](#hostport) or [NodePort](#nodeport) as a replacement. -## HostPorts +## HostPort A _HostPort_ is a port exposed to the public on a _specific node_ running one or more pod. Traffic to the node and the exposed port (`:`) are routed to the requested container's private port. Using a HostPort for a Kubernetes pod in Rancher v2.x is synonymous with creating a public port mapping for a container in Rancher v1.6. @@ -53,7 +53,7 @@ In the following diagram, a user is trying to access an instance of Nginx, which - Any two workloads that specify the same HostPort cannot be deployed to the same node. - If the host where your pods are running becomes unavailable, Kubernetes reschedules the pods to different nodes. Thus, if the IP address for your workload changes, external clients of your application will lose access to the pod. The same thing happens when you restart your pods—Kubernetes reschedules them to a different node. -## Setting HostPorts +## Setting HostPort You can set a HostPort for migrated workloads (i.e., services) using the Rancher v2.x UI. To add a HostPort, browse to the project containing your workloads, and edit each workload that you want to expose, as shown below. Map the port that your service container exposes to the HostPort exposed on your target node. @@ -63,67 +63,7 @@ For example, for the web-deployment.yml file parsed from v1.6 that we've been us ![Set HostPort]({{< baseurl >}}/img/rancher/set-hostport.gif) - - - -## NodePorts +## NodePort A _NodePort_ is a port that's open to the public _on each_ of your cluster nodes. When the NodePort receives a request for any of the cluster hosts' IP address for the set NodePort value, NodePort (which is a Kubernetes service) routes traffic to a specific pod, regardless of what node it's running on. NodePort provides a static endpoint where external requests can reliably reach your pods. @@ -133,8 +73,7 @@ In the following diagram, a user is trying to connect to an instance of Nginx ru ![NodePort Diagram]({{< baseurl >}}/img/rancher/nodePort.svg) -NodePorts are available within your Kubernetes cluster on an internal IP. If you want to expose pods external to the cluster, use NodePorts in conjunction with an external load balancer. Traffic requests from outside your cluster for `:` are directed to the workload by kube-proxy. The `` can be the IP address of any node in your Kubernetes cluster. - +NodePorts are available within your Kubernetes cluster on an internal IP. If you want to expose pods external to the cluster, use NodePorts in conjunction with an external load balancer. Traffic requests from outside your cluster for `:` are directed to the workload. The `` can be the IP address of any node in your Kubernetes cluster. #### NodePort Pros @@ -144,15 +83,14 @@ NodePorts are available within your Kubernetes cluster on an internal IP. If you #### NodePort Cons - When a NodePort is used, that `:` is reserved in your Kubernetes cluster on all nodes, even if the workload is never deployed to the other nodes. -- You can only specify a port from the configured range (`30000-32767`) and not any random port. +- You can only specify a port from a configurable range (by default, it is `30000-32767`). - An extra Kubernetes object (a Kubernetes service of type NodePort) is needed to expose your workload. Thus, finding out how your application is exposed is not straightforward. - -## Setting NodePorts +## Setting NodePort You can set a NodePort for migrated workloads (i.e., services) using the Rancher v2.x UI. To add a NodePort, browse to the project containing your workloads, and edit each workload that you want to expose, as shown below. Map the port that your service container exposes to a NodePort, which you'll be able to access from each cluster node. -For example, for the web-deployment.yml file parsed from v1.6 that we've been using as a sample, we would edit its Kubernetes manifest, set the publish the port that the container uses, and then declare a NodePort. You can then access your workload by clicking the link created in the Rancher UI. +For example, for the `web-deployment.yml` file parsed from v1.6 that we've been using as a sample, we would edit its Kubernetes manifest, set the publish the port that the container uses, and then declare a NodePort. You can then access your workload by clicking the link created in the Rancher UI. >**Note:** > @@ -163,70 +101,4 @@ For example, for the web-deployment.yml file parsed from v1.6 that we've been us ![Set NodePort]({{< baseurl >}}/img/rancher/set-nodeport.gif) - - - ### [Next: Configure Health Checks]({{< baseurl >}}/rancher/v2.x/en/v1.6-migration/monitor-apps) diff --git a/static/img/rancher/hostPort.svg b/static/img/rancher/hostPort.svg new file mode 100644 index 00000000000..4e73ab4ae0a --- /dev/null +++ b/static/img/rancher/hostPort.svg @@ -0,0 +1,2 @@ + +
Kubernetes Cluster
[Not supported by viewer]
Node
[Not supported by viewer]
Node
[Not supported by viewer]
Node
[Not supported by viewer]
Nginx
[Not supported by viewer]
port: 80
port: 80
External Client
<Node_IP>: 9890
<Node_IP>: 9890
hostPort: 9890
[Not supported by viewer]
\ No newline at end of file diff --git a/static/img/rancher/nodePort.svg b/static/img/rancher/nodePort.svg new file mode 100644 index 00000000000..05508617e6b --- /dev/null +++ b/static/img/rancher/nodePort.svg @@ -0,0 +1,2 @@ + +
Kubernetes Cluster
[Not supported by viewer]
External Client
Node
[Not supported by viewer]
kube-proxy
[Not supported by viewer]
Node
[Not supported by viewer]
kube-proxy
[Not supported by viewer]
nodePort Service
[Not supported by viewer]
port: 30216
[Not supported by viewer]
port: 30216
[Not supported by viewer]
port: 30216
[Not supported by viewer]
<NODE_IP>: 30216
[Not supported by viewer]
Node
[Not supported by viewer]
kube-proxy
[Not supported by viewer]
Nginx
[Not supported by viewer]
port: 80
port: 80
\ No newline at end of file diff --git a/static/img/rancher/resolve-ports.png b/static/img/rancher/resolve-ports.png new file mode 100644 index 00000000000..0383ff5f7d3 Binary files /dev/null and b/static/img/rancher/resolve-ports.png differ diff --git a/static/img/rancher/set-hostport.gif b/static/img/rancher/set-hostport.gif new file mode 100644 index 00000000000..9d5100df4c1 Binary files /dev/null and b/static/img/rancher/set-hostport.gif differ diff --git a/static/img/rancher/set-nodeport.gif b/static/img/rancher/set-nodeport.gif new file mode 100644 index 00000000000..5a328169f87 Binary files /dev/null and b/static/img/rancher/set-nodeport.gif differ