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.
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
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
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://<ipAdress for environment1 host>:3000/;
}
#Aplication version 2
location /environment2/applicationStack{
proxy_pass http://<ipAdress for environment2 host>:3000/;
}
#rancher
location /rancher {
rewrite ^([^.]*[^/])$ $1/ permanent;
rewrite ^/rancher/(.*)$ /$1 break;
proxy_pass http://<ipAdress for enviroment with nginx>:8080;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
}
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?
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?
Enviroments in 1.6.x would map to multiple Kubernetes clusters in 2.x.
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.
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.
Idea: (You need to refer the documentation to explore various ingress options and pick the right one for your use case)
#Aplication version 1
location /app1 {
proxy_pass http://<ipAdress k8s cluster 1 host>:80/app1;
}
Also if you want to understand Ingress in detail you might find the recordings of my talks useful: