I am running with this environment:
VM1: Rancher 1.4
VM2, VM3, VM3: RHEL 7.2, Docker 1.12.3
Trying to deploy a plain vanilla apache service
modified my swarm template to version 1.12.3 (instead of the latest beta) with one manager.
create environment based on swarm template.
add three nodes to this environment (VM2, VM3, VM3).
create private docker registry
create a stack
add my apache service to the stack, run 3 containers, map ports 80:80, 443:443, leaving all other defaults including network=managed.
Nodes show services deployed (one on each node in the swarm). I am able to navigate to the apache home page via clicking on the port number link on the infrastructure page. Now when I attempt to scale to a 4th container instance, I receive the following exception in Rancher:
Failed to allocate instance [container:1i4308]: Bad instance [container:1i4308] in state [error]: Allocation failed: host needs ports 80/tcp, 443/tcp available. It looks like a port conflict on the node to which it is deploying, so I suspect an issue with my network settings for the service. The documentation indicates I should be using Managed, but maybe I need to change additional configuration settings.
80:80 means to use port 80 on the host. When you try to add a 4th one in an environment with 3 hosts, there aren’t any hosts where it can be scheduled to because none have port 80 available.
Thanks for the quick reply Vincent. I have tried both however. The apache service I am deploying listens on the standard ports 80 and 443. In docker, I am guessing that you are saying that I need to specify something other than port 80 for the host port (or leave it blank and let Rancher assign). I have tried both of these methods without success.
I have not seen an example or video which shows a service which has a port mapped deployed to a swarm cluster via Rancher. If you know of any or can provide me an example I would very much appreciate it. Thanks again.
We are looking to orchestrate a docker swarm from within the Rancher environment. Unfortunately, it appears that the current version of Rancher, 1.4., does not support Docker’s ‘mesh routing’ load balancing mechanism. Based upon research today, I was better able to research the disconnect between Rancher Services and Docker Swarm. It seems that …‘the mesh routing of Docker swarm mode isn’t in Rancher, but using the load balancer provides similar functionality’
I think the problem here is you’re creating services in the UI. You’re interacting with Cattle, not Swarm. There is no custom UI for Swarm. If you create swarm-mode services (through docker service create -p ... their nodePort thing should work.