<p>Currently I’m using rancher 1.x for on my work and I have being migration to rancher 2x. I’m having a hard time to understand how could I migrate this to rancher 2.X or if I would need to reconfigure everything.
I used the migration tools to create my yaml files, and for each application it created 2 files, one deployment and one service.</p>

<p>When adding the service files on rancher 2.x it created each Service with a Cluster Ip, the Port Mapping was created with Publish Service port as my Rancher 1x Public Host Port and the target Port as my rancher 1.x Private Container Port</p>

<p>But, Currently I’m using Nginx for the applications on different versions and locating them by environment/stack for each application, the following is an exemple of my current nginx.conf</p>

<pre><code>worker_processes 1;

error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;

events {
worker_connections 1024;
}

http {

server {
listen 80;

  #Aplication version 1
   location /environment1/applicationStack{
       proxy_pass http://&lt;ipAdress for environment1 host&gt;:3000/;
   }

  #Aplication version 2
   location /environment2/applicationStack{
       proxy_pass http://&lt;ipAdress for environment2 host&gt;:3000/;
   }

   #rancher
   location /rancher {
       rewrite ^([^.]*[^/])$ $1/ permanent;
       rewrite ^/rancher/(.*)$ /$1 break;
       proxy_pass      http://&lt;ipAdress for enviroment with nginx&gt;:8080;
       proxy_redirect  off;
       proxy_set_header Host $host;
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
   }
}
}

</code></pre>

<p>So for example if I wanted to connect to each application it would be the rancherDNS:8080/environmentVersion/stackName
I’m having a hard time to understand how could I migrate this to rancher 2.X or if I would need to reconfigure everything. How should I configure the nginx file? should I use each service ClusterIp with the target port? or the Publish port? Or this ClusterIp is not even what I should configure?</p>

<p>Another thing is that we currently use CI with Travis, if Travis published a new pod in a deployment, this would not affect my service, right?</p>

<p>Enviroments in 1.6.x would map to multiple Kubernetes clusters in 2.x.</p>

<p>You could convert your 1.6.x Stacks to either Deployment or DaemonSet Specs for 2.x. Then you can create an ingress object to access them. When creating an ingress you can specify the hostname/fqdn directly, that way you don't have to use your currently nginx. </p>

<p>If you prefer to use your current nginx, you can skip specifying fqdn/hostname in the ingress object and use the host IP addresses of your cluster.</p>

<p>Idea: (You need to refer the <a href="https://kubernetes.io/docs/concepts/services-networking/ingress/" rel="nofollow noreferrer">documentation</a> to explore various ingress options and pick the right one for your use case)</p>

<pre><code>#Aplication version 1
   location /app1 {
       proxy_pass http://&lt;ipAdress k8s cluster 1 host&gt;:80/app1;
   }
</code></pre>

<p>Also if you want to understand Ingress in detail you might find the recordings of my talks useful:</p>

<ul>
<li><a href="https://www.youtube.com/watch?v=FG0ZW5eX1JY" rel="nofollow noreferrer">Load Balancing with Kubernetes: concepts, use cases, and
implementation details</a></li>
<li><a href="https://www.youtube.com/watch?v=GXq3FS8M_kw" rel="nofollow noreferrer">Kubernetes Networking Master Class</a></li>
</ul>
