Portainer on multiple Manager Nodes

Hello everyone,

We are in the process of going into production testing and we have 3 manager nodes. We want Portainer to run on each manager node in case of one going down. When deploying though, only one instance is running on one manager, all others are rejected. Any ideas on how to fix that?

My yml file for docker deploy:

version: '3.2'

services:
  agent:
    image: portainer/agent
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /var/lib/docker/volumes:/var/lib/docker/volumes
    networks:
      - agent_network
    deploy:
      mode: global
      placement:
        constraints: [node.platform.os == linux]

  portainer:
    image: {PORTAINER_IMAGE}
    command: -H tcp://tasks.agent:9001 --tlsskipverify
    ports:
      - "9000:9000"
      - "8000:8000"
    volumes:
      - portainer_data:/data
    networks:
      - agent_network
    deploy:
      mode: global
      placement:
        constraints: [node.role == manager]

networks:
  agent_network:
    driver: overlay
    attachable: true

volumes:
  portainer_data:
    driver: local
    driver_opts:
      type: nfs
      o: nfsvers=4,addr=nfsdocker.xxxxxxx.xx,rw
      device: ":/zfs/docker/portainer"

There should be only one instance of Portainer running in a swarm at a time. However the agent is meant to run globally in the swarm, so that you can consolidate info from each of these nodes such as volumes and images.

Portainer isn’t yet HA, if the manager goes down and portainer is rescheduled by swarm on another node, then you lose the DB stored on that node. For this situation you can use NFS for HA storage in swarm and have the DB there