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

Service assigned ip address is off by one #6541

Closed
stratosgear opened this issue Mar 21, 2020 · 1 comment
Closed

Service assigned ip address is off by one #6541

stratosgear opened this issue Mar 21, 2020 · 1 comment

Comments

@stratosgear
Copy link

Do you want to request a feature or report a bug?

Bug (?)

What did you do?

On docker swarm I am trying to bring up two different stacks: One for Traefik only and
another for Swarmpit.

traefik.yml:

version: "3.5"

services:
    proxy:
        image: traefik:v2.1
        command:
            - --api.insecure=true
            - --api.debug=true
            - --api.dashboard=true
            - --providers.docker
            - --providers.docker.swarmMode
            - --providers.docker.exposedByDefault=false
            - --accessLog=true
        ports:
            - "80:80"
            - "8080:8080"
        volumes:
            - /var/run/docker.sock:/var/run/docker.sock
        deploy:
            placement:
                constraints:
                    - node.role == manager
            labels:
                - "traefik.enable=true"
                - "traefik.http.routers.proxy.rule=Host(`traefik.rapidxmm.n1vs.lan`)"
                - "traefik.http.services.proxy.loadbalancer.server.port=80"
                - "traefik.http.routers.proxy.service=api@internal" 
        networks:
            - traefik-public

networks:
    traefik-public:
        external: true

swarmpit.yml:

version: "3.5"

services:
    app:
        image: swarmpit/swarmpit:latest
        environment:
            - SWARMPIT_DB=http://db:5984
            - SWARMPIT_INFLUXDB=http://influxdb:8086
        volumes:
            - /var/run/docker.sock:/var/run/docker.sock:ro
        # ports:
        #     - 8080
        networks:
            - net
            - traefik-public
        deploy:
            resources:
                limits:
                    cpus: "0.50"
                    memory: 1024M
                reservations:
                    cpus: "0.25"
                    memory: 512M
            placement:
                constraints:
                    - node.role == manager
            labels:
                - "traefik.enable=true"
                - "traefik.http.routers.app.rule=Host(`swarmpit.rapidxmm.n1vs.lan`)"
                - "traefik.http.services.app.loadbalancer.server.port=8080"

    db:
        image: couchdb:2.3.0
        volumes:
            - db-data:/opt/couchdb/data
        networks:
            - net
        deploy:
            resources:
                limits:
                    cpus: "0.30"
                    memory: 256M
                reservations:
                    cpus: "0.15"
                    memory: 128M

    influxdb:
        image: influxdb:1.7
        volumes:
            - influx-data:/var/lib/influxdb
        networks:
            - net
        deploy:
            resources:
                limits:
                    cpus: "0.60"
                    memory: 512M
                reservations:
                    cpus: "0.30"
                    memory: 128M                

    agent:
        image: swarmpit/agent:latest
        environment:
            - DOCKER_API_VERSION=1.35
        volumes:
            - /var/run/docker.sock:/var/run/docker.sock:ro
        networks:
            - net
        deploy:
            mode: global
            labels:
                swarmpit.agent: "true"
            resources:
                limits:
                    cpus: "0.10"
                    memory: 64M
                reservations:
                    cpus: "0.05"
                    memory: 32M


networks:
    net:
        driver: overlay
        attachable: true
    traefik-public:
        external: true

volumes:
    db-data:
        driver: local
    influx-data:
        driver: local

Both startup fine:

[me@someserver aux]$ docker stack deploy -c traefik.yml traefik
Creating service traefik_proxy
[me@someserver aux]$ docker stack deploy -c swarmpit.yml swarmpit
Creating network swarmpit_net
Creating service swarmpit_app
Creating service swarmpit_db
Creating service swarmpit_influxdb
Creating service swarmpit_agent

Checking the traefik dashboard I see my defined routes and services:
routers

But what I see as an IP address for the swarmpit app service:

service

does not agree with the IP I get when I inspect the service from the command line:

[me@someserver aux]$ docker service ls
ID                  NAME                MODE                REPLICAS            IMAGE                      PORTS
xk9cqt71nq22        swarmpit_agent      global              2/2                 swarmpit/agent:latest      
wwvfxte3du7l        swarmpit_app        replicated          1/1                 swarmpit/swarmpit:latest   
t7qwy9ikxvq2        swarmpit_db         replicated          1/1                 couchdb:2.3.0              
wmwxhb7q0700        swarmpit_influxdb   replicated          1/1                 influxdb:1.7               
sar865abr2jr        traefik_proxy       replicated          1/1                 traefik:v2.1               *:80->80/tcp, *:8080->8080/tcp
[me@someserver aux]$ docker service inspect swarmpit_app
[
    {
        "ID": "gjzmgikpp8q75ah3nvetpmvo2",
        "Version": {
            "Index": 5592180
        },
        "CreatedAt": "2020-03-21T14:34:04.731630497Z",
        "UpdatedAt": "2020-03-21T14:34:04.732734158Z",
        "Spec": {
            "Name": "swarmpit_app",
            "Labels": {
                "com.docker.stack.image": "swarmpit/swarmpit:latest",
                "com.docker.stack.namespace": "swarmpit",
                "traefik.enable": "true",
                "traefik.http.routers.app.rule": "Host(`swarmpit.rapidxmm.n1vs.lan`)",
                "traefik.http.services.app.loadbalancer.server.port": "8080"
            },
            "TaskTemplate": {
                "ContainerSpec": {
                    "Image": "swarmpit/swarmpit:latest@sha256:aa0588ee3edeaade86b3bd33136d8f48c3d7c437bc56125ac78f518546c7122f",
                    "Labels": {
                        "com.docker.stack.namespace": "swarmpit"
                    },
                    "Env": [
                        "SWARMPIT_DB=http://db:5984",
                        "SWARMPIT_INFLUXDB=http://influxdb:8086"
                    ],
                    "Privileges": {
                        "CredentialSpec": null,
                        "SELinuxContext": null
                    },
                    "Mounts": [
                        {
                            "Type": "bind",
                            "Source": "/var/run/docker.sock",
                            "Target": "/var/run/docker.sock",
                            "ReadOnly": true
                        }
                    ],
                    "StopGracePeriod": 10000000000,
                    "DNSConfig": {},
                    "Isolation": "default"
                },
                "Resources": {
                    "Limits": {
                        "NanoCPUs": 500000000,
                        "MemoryBytes": 1073741824
                    },
                    "Reservations": {
                        "NanoCPUs": 250000000,
                        "MemoryBytes": 536870912
                    }
                },
                "RestartPolicy": {
                    "Condition": "any",
                    "Delay": 5000000000,
                    "MaxAttempts": 0
                },
                "Placement": {
                    "Constraints": [
                        "node.role == manager"
                    ],
                    "Platforms": [
                        {
                            "Architecture": "amd64",
                            "OS": "linux"
                        },
                        {
                            "Architecture": "arm64",
                            "OS": "linux"
                        },
                        {
                            "OS": "linux"
                        },
                        {
                            "OS": "linux"
                        }
                    ]
                },
                "Networks": [
                    {
                        "Target": "wh03wkmtwr5aga8lgbwuc304k",
                        "Aliases": [
                            "app"
                        ]
                    },
                    {
                        "Target": "bkrqbq1zyvcoienddlofftb32",
                        "Aliases": [
                            "app"
                        ]
                    }
                ],
                "ForceUpdate": 0,
                "Runtime": "container"
            },
            "Mode": {
                "Replicated": {
                    "Replicas": 1
                }
            },
            "UpdateConfig": {
                "Parallelism": 1,
                "FailureAction": "pause",
                "Monitor": 5000000000,
                "MaxFailureRatio": 0,
                "Order": "stop-first"
            },
            "RollbackConfig": {
                "Parallelism": 1,
                "FailureAction": "pause",
                "Monitor": 5000000000,
                "MaxFailureRatio": 0,
                "Order": "stop-first"
            },
            "EndpointSpec": {
                "Mode": "vip"
            }
        },
        "Endpoint": {
            "Spec": {
                "Mode": "vip"
            },
            "VirtualIPs": [
                {
                    "NetworkID": "wh03wkmtwr5aga8lgbwuc304k",
                    "Addr": "10.0.12.2/24"
                },
                {
                    "NetworkID": "bkrqbq1zyvcoienddlofftb32",
                    "Addr": "10.0.6.36/24"
                }
            ]
        }
    }
]

As you see the swamrpit_app runs on 10.0.11.2 but traefik reports 10.0.11.3. This
is always off by one (traefik always larger), even if I restart stacks.

What did you expect to see?

Well, I guess, the correct IPs.

For traefik, for example, that everything resolves correctly that address that traefik
reports for the traefik server definition agrees with what I see from docker.

What did you see instead?

Trying to load the swarmpit from swarmpit.rapidxmm.n1vs.lan gives me a blank white
page with the text Gateway Timeout

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

Version:      2.1.8
Codename:     cantal
Go version:   go1.13.8
Built:        2020-03-19T15:08:56Z
OS/Arch:      linux/amd64

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

  • No traefik config except the command line params in the docker-compose file.
[me@someserver aux]$ uname -a
Linux xmmrapid01 3.10.0-1062.7.1.el7.x86_64 #1 SMP Wed Nov 13 08:44:42 EST 2019 x86_64 x86_64 x86_64 GNU/Linux
[me@someserver aux]$ docker --version
Docker version 19.03.5, build 633a0ea
[me@someserver aux]$ docker-compose version
docker-compose version 1.18.0, build 8dd22a9
docker-py version: 2.6.1
CPython version: 3.6.8
OpenSSL version: OpenSSL 1.0.2k-fips  26 Jan 2017

If applicable, please paste the log output in DEBUG level (--log.level=DEBUG switch)

Attached as it is quite big.

traefik_debug.log

@traefiker
Copy link
Contributor

Hi! I'm Træfiker 🤖 the bot in charge of communication regulation.

Thanks for your interest in Traefik!

We dedicate the issue tracker to bug reports and feature requests only. My advanced AI has spotted that your issue might be a configuration problem or relates to something that doesn't look like a bug.

To confirm this, please join our Community Forum and reach out to us on the Traefik section.

In case I'm wrong (well, that would be embarrassing 😅), my developers will re-open the issue and fix me!

In the meantime, you can double check Traefik's documentation.

@traefik traefik locked and limited conversation to collaborators Apr 28, 2020
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

2 participants