Portainer and remote portainer edge agent on vps

Hi!

Guys could someone explame me please, how I can expose the 8000 default edge port correctly via Traefik for connection between Portainer and remote edge agent?

Here is my yaml for portainer host:

http:
  routers:
    portainer:
      service: portainer
      rule: "Host(`portainer.host.com`)"
      entryPoints:
        - websecure
      tls:
        certresolver: myresolver

  services:
    portainer:
      loadBalancer:
        servers:
          - url: "http://192.168.140.30:9000"

As I understood from agent's log, my vps is trying to connect via ws, I'm had tryed to add edge.host.com with the same settings and 8000 port, trying to add xforwardproto but without results, any suggestion?

Oh seems I found the solution, but need to check it...

I solved it with the next steps:

  1. Add edge router:
http:
  routers:
    portainer:
      service: portainer
      rule: "Host(`portainer.host.com`)"
      entryPoints:
        - websecure
      tls:
        certresolver: myresolver

    edge:
      service: edge
      rule: "Host(`edge.host.com`)"
      entryPoints:
        - websecure
      tls:
        certresolver: myresolver

  services:
    portainer:
      loadBalancer:
        servers:
          - url: "http://192.168.0.30:9000"

    edge:
      loadBalancer:
        servers:
          - url: "http://192.168.0.30:8000"
  1. This step is related to the peculiarities of the implementation of agent-server communication, this will probably be fixed in the next releases, I will leave it here if someone has the same need to add the ability to communicate with the agent to the server using wss:
  • 2.1 At server side is need to create environment via edge agent but without adding
  • 2.2 Need to decode the base64 encoded join token like:
  • https://portainer.host.com|portainer.host.com:8000|aa:bb:cc:dd:ee:ff:00:00:00:00:00:00:00:00:00:00|1 via https://www.base64encode.org
  • 2.3 Now need is modify edge (second) value in the url, add https, fix host and remove port like this:
  • https://portainer.host.com|https://edge.host.com|aa:bb:cc:dd:ee:ff:00:00:00:00:00:00:00:00:00:00|1
  • 2.4 Next is back to https://www.base64encode.org and encode new token back to url base64 format
  • 2.5 Now can add new environment with a new token at agent side

That's it.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.