Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Traefik not finding dynamically added services (Docker Swarm Mode) #1168

Closed
austinfrey opened this issue Feb 16, 2017 · 2 comments
Closed

Traefik not finding dynamically added services (Docker Swarm Mode) #1168

austinfrey opened this issue Feb 16, 2017 · 2 comments

Comments

@austinfrey
Copy link

What version of Traefik are you using (traefik version)?

Version: v1.1.2
Codename: camembert
Go version: go1.7.4
Built: 2016-12-15_10:21:15AM
OS/Arch: linux/amd64

What is your environment & configuration (arguments, toml...)?

currently launching as part of a docker stack deploy command

traefik:
    image: traefik:latest
    command: -c --docker=true --docker.swarmmode=true --docker.domain=traefik --docker.watch =true --web=true --debug=true
    ports:
      - 80:80
      - 8080:8080
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock"
    networks:
      - traefik-net
    deploy:
      placement:
        constraints: [node.role == manager]

What did you do?

launched Traefik via docker stack deploy I have another service that will create new services and attaches them to the traefik network. They have traefik.port and traefik.frontend.rule labels. I also created a service with the same labels via the docker CLI

What did you expect to see?

I should be able to interact with this new service via traefik.

What did you see instead?

Currently I can not interact with the service. I CAN interact with services with the same apparent setup when created via docker CLI

Debug log showing test1 service is recongnized by traefik but no IP is attached. This service was created using docker-py from another service, and test2 the service created by docker CLI

{
  "backends": {
      "backend-aafrey-test2": {
          "servers": {
              "server-aafrey-test2": {
                  "url": "http://10.0.0.3:8080",
                  "weight": 0
              }
          },
          "loadBalancer": {
              "method": "wrr"
          }
      },
      "backend-aafrey85-test1": {
          "servers": {
              "server-aafrey85-test1": {
                  "url": "http://:8080",
                  "weight": 0
              }
          },
          "loadBalancer": {
              "method": "wrr"
          }
      },
      "backend-lpp-portainer": {
          "servers": {
              "server-lpp_portainer": {
                  "url": "http://10.0.0.6:9000",
                  "weight": 0
              }
          },
          "loadBalancer": {
              "method": "wrr"
          }
      }
  },
  "frontends": {
      "frontend-PathPrefixStrip-aafrey-test2-Method-GET-POST": {
          "entryPoints": ["http"],
          "backend": "backend-aafrey-test2",
          "routes": {
              "route-frontend-PathPrefixStrip-aafrey-test2-Method-GET-POST": {
                  "rule": "PathPrefixStrip:/aafrey-test2;Method:GET,POST"
              }
          },
          "passHostHeader": true,
          "priority": 0
      },
      "frontend-PathPrefixStrip-aafrey85-gmail-com-test1-RECOMMENDATIONS-Method-GET-POST": {
          "entryPoints": ["http"],
          "backend": "backend-aafrey85-test1",
          "routes": {
              "route-frontend-PathPrefixStrip-aafrey85-gmail-com-test1-RECOMMENDATIONS-Method-GET-POST": {
                  "rule": "PathPrefixStrip:/[email protected];Method:GET,POST"
              }
          },
          "passHostHeader": true,
          "priority": 0
      },
      "frontend-PathPrefixStrip-admin": {
          "entryPoints": ["http"],
          "backend": "backend-lpp-portainer",
          "routes": {
              "route-frontend-PathPrefixStrip-admin": {
                  "rule": "PathPrefixStrip:/admin"
              }
          },
          "passHostHeader": true,
          "priority": 0
      }
  }
}

Below are results of docker service inspect for both services.
test1 (unavailable service)

{
  "backends": {
      "backend-aafrey-test2": {
          "servers": {
              "server-aafrey-test2": {
                  "url": "http://10.0.0.3:8080",
                  "weight": 0
              }
          },
          "loadBalancer": {
              "method": "wrr"
          }
      },
      "backend-aafrey85-test1": {
          "servers": {
              "server-aafrey85-test1": {
                  "url": "http://:8080",
                  "weight": 0
              }
          },
          "loadBalancer": {
              "method": "wrr"
          }
      },
      "backend-lpp-portainer": {
          "servers": {
              "server-lpp_portainer": {
                  "url": "http://10.0.0.6:9000",
                  "weight": 0
              }
          },
          "loadBalancer": {
              "method": "wrr"
          }
      }
  },
  "frontends": {
      "frontend-PathPrefixStrip-aafrey-test2-Method-GET-POST": {
          "entryPoints": ["http"],
          "backend": "backend-aafrey-test2",
          "routes": {
              "route-frontend-PathPrefixStrip-aafrey-test2-Method-GET-POST": {
                  "rule": "PathPrefixStrip:/aafrey-test2;Method:GET,POST"
              }
          },
          "passHostHeader": true,
          "priority": 0
      },
      "frontend-PathPrefixStrip-aafrey85-gmail-com-test1-RECOMMENDATIONS-Method-GET-POST": {
          "entryPoints": ["http"],
          "backend": "backend-aafrey85-test1",
          "routes": {
              "route-frontend-PathPrefixStrip-aafrey85-gmail-com-test1-RECOMMENDATIONS-Method-GET-POST": {
                  "rule": "PathPrefixStrip:/[email protected];Method:GET,POST"
              }
          },
          "passHostHeader": true,
          "priority": 0
      },
      "frontend-PathPrefixStrip-admin": {
          "entryPoints": ["http"],
          "backend": "backend-lpp-portainer",
          "routes": {
              "route-frontend-PathPrefixStrip-admin": {
                  "rule": "PathPrefixStrip:/admin"
              }
          },
          "passHostHeader": true,
          "priority": 0
      }
  }
}

test2 (available service)

{
  "ID": "ztbop084ygn0ey8x9mbyrqdal",
  "Version": {
      "Index": 20889
  },
  "CreatedAt": "2017-02-16T15:48:14.182750038Z",
  "UpdatedAt": "2017-02-16T15:48:14.184011588Z",
  "Spec": {
      "Name": "aafrey-test2",
      "Labels": {
          "traefik.frontend.rule": "PathPrefixStrip:/aafrey-test2;Method:GET,POST",
          "traefik.port": "8080"
      },
      "TaskTemplate": {
          "ContainerSpec": {
              "Image": "aafrey/lpp-js:latest@sha256:e847ff5eab4d8b1bc924f8046c7b0fe785e920a033952847c2263088af4da8a1",
              "DNSConfig": {}
          },
          "Resources": {
              "Limits": {},
              "Reservations": {}
          },
          "RestartPolicy": {
              "Condition": "any",
              "MaxAttempts": 0
          },
          "Placement": {},
          "Networks": [
              {
                  "Target": "k27c9x7slogkd527h9qn7wvz0"
              }
          ],
          "ForceUpdate": 0
      },
      "Mode": {
          "Replicated": {
              "Replicas": 1
          }
      },
      "UpdateConfig": {
          "Parallelism": 1,
          "FailureAction": "pause",
          "MaxFailureRatio": 0
      },
      "Networks": [
          {
              "Target": "traefik-net"
          }
      ],
      "EndpointSpec": {
          "Mode": "vip"
      }
  },
  "Endpoint": {
      "Spec": {
          "Mode": "vip"
      },
      "VirtualIPs": [
          {
              "NetworkID": "k27c9x7slogkd527h9qn7wvz0",
              "Addr": "10.0.0.3/24"
          }
      ]
  },
  "UpdateStatus": {
      "StartedAt": "0001-01-01T00:00:00Z",
      "CompletedAt": "0001-01-01T00:00:00Z"
  }
}

Any help is appreciated. Thanks!

@austinfrey
Copy link
Author

this was solved by passing endpoint_spec={'Mode': 'vip'} as a parameter in the client.services.create() call. so this was a docker-py issue not a traefik issue. sweet relief....

@nejec
Copy link

nejec commented Mar 7, 2017

We are expiriencing same issues with traefik:v1.2.0-rc2, since traefik dynamic configuration is not updated when new service is deployed to swarm.

Using:

  • Ubuntu 16.04.1 LTS
  • docker-py==1.10.6
  • docker-engine 1.13.1-0~ubuntu-xenial

This was working fine with traefik:6c92697 with the same version of docker-engine and docker-py.

@traefik traefik locked and limited conversation to collaborators Sep 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants