biro
biro

Reputation: 11

Jenkins node in docker swarm deployed with docker stack not detected anymore

I'm running Jenkins with worker nodes in a docker swarm. I use docker stack with a docker-compose.yml file to deploy the nodes. Within the Jenkins container, I have the swam plugin installed.

Everything went well, all nodes were detected on Jenkins startup and added to the master node. Now, suddenly this does not work anymore. The master node does not detect the worker nodes.

To init docker swarm I use

docker swarm init

To start my docker containers I use

docker stack deploy --compose-file <path_to_compose_file> <name_of_stack>

I reduced the docker-compose.yml to the essentials. docker-compose.yml:

version: '3'

services:

  jenkins-master:
    image: jenkins-master:latest
    volumes:
      - /var/docker-data/master-volume:/var/jenkins_home
      - /var/docker-data/backup-volume:/var/lib/backup
    ports:
      - "443:8443"
      - "80:8080"
      - "50000:50000"
    networks:
      - jenkins_swarm
    deploy:
      placement:
        constraints:
          - node.role == manager

  jenkins-worker:
    image: jenkins-worker:latest
    networks:
      - jenkins_swarm
    command: -labels "worker" -executors 8 -master "http://<IP of master>/"
    deploy:
      mode: replicated
      replicas: 1
      placement:
        constraints:
          - node.role == manager

networks:
  jenkins_swarm:

Is anybody facing similar issues? Did I do something wrong?

Upvotes: 0

Views: 266

Answers (1)

Saxtheowl
Saxtheowl

Reputation: 4668

You can verify that each worker is running properly by running docker info on each of them, also verify that Jenkins master node is able to connect to the worker nodes, check the logs, check that the swarm plugin is installed and running properly, and finaly check the configuration of jenkins-worker in your docker-compose.yml file.

Upvotes: 0

Related Questions