Internal and External reverse proxy network using kubernetes and traefik, how?

12/13/2019

I am trying to learn kubernetes and rancher. Here is what i want to accomplish :

I have few docker containers which i want to service only from my internal network using x.mydomain.com I have same as above but those containers will be accessible from internet on x.mydomain.com What i have at the moment is following :

Rancher server RancherOS to be used for the cluster and as one node I have made a cluster and added the node from 2. and disabled the nginx controller. Install traefik app I have forwarded port 80, 443 to my node. Added few containers Added ingress rules So at the moments it works with the external network. I can write app1.mydomain.com from the internet and everything works as it should.

Now my problem is how can i add the internal network now ?

Do i create another cluster ? Another node on the same host ? Should i install two traefik and then use class in ingress for the internal stuff ?

My idea was to add another ip to the same interface on the rancheros then add another node on the same host but with the other ip but i can’t get it to work. Rancher sees both nodes with the same name and doesn’t use the information i give it i mean --address when creating the node. Of course even when i do this it would require that i setup a DNS server internally so it knows which domains are served internally but i haven’t done that yet since i can’t seem to figure out how to handle the two ip on the host and use them in two different nodes. I am unsure what is require, maybe it’s the wrong route i am going.

I would appreciate if somebody had some ideas.

Update : I thought i had made it clear what i want from above. There is no YAML at the moment since i don't know how to do it. In my head it's simple what i want. Let me try to cook it down with an example :

I want 2 docker containers with web server to be able to be accessible from the internet on web1.mydomain.com and web2.mydomain.com and at the same time i want 2 docker containers with web server that i can access only from internal network on web3.mydomain.com and web4.mydomain.com.

Additional info : - I only have one host that will be hosting the services. - I only have one public IPv4 address. - I can add additional ip alias to the one host i have. - I can if needed configure an internal DNS server if required.

/donnib

-- dbrasco
kubernetes
rancher
traefik

0 Answers