Using the Portainer Edge Agent, Edge Groups, and Edge Stacks - part 1

by Portainer team, on Feb 19, 2021 8:12:03 PM

 


Portainer has an amazing feature that lets you manage remote edge compute devices from a single centralized instance. You can manage for up to 25,000 x86 or ARM based edge devices running on unreliable or highly latent networks with support for Windows and Linux Operating Systems.

In this How-To we are going to learn how to enable the edge compute feature of Portainer that I have split into two parts:

  • The first part will show how simple it is to add edge devices via the Edge Agent and the importance of using tags for endpoints;
  • in the second part I show how to enable the Edge Compute features of Portainer and how to manage edge devices with this feature.

Adding Tags

  1. Start by logging in your Portainer instance and selecting the Endpoint -> Tags menu option:


    Tags help you organize your endpoints based on criteria. So for instance let's say we have 4 different categories that you may want to group your endpoints in: architecture, geography, image and function

  2. You can add your tags freely as these are simple text inputs:


  3. Considering the criteria I mentioned item #1 I added:
    1. Architecture: x86 and arm64
    2. Geography: north and south
    3. Image: mysql, redis and prometheus
    4. Function: metrics and db


      You can use whatever criteria you prefer. As you can see Tags are very easy to add.

Adding Endpoints with the Edge Agent on Portainer

  1. Start by clicking on Endpoint -> Add endpoint:


  2. Select Edge Agent:


  3. You can name your endpoint accordingly. One very important detail is to make sure that the IP address of the Portainer server URL matches the one of the machine where the endpoint is going to be added:


  4. Add the tag or tags that you want for this endpoint using the criteria you believe is appropriate for the device:


  5. On the Endpoint details page make sure to select Docker Swarm for the agent. For now the Edge Compute feature of Portainer only supports docker swarm nodes:


    Make sure to click on the Copy command button in order to deploy the portainer agent on the edge device.

  6. Add the IP address of the edge device and click on Update endpoint:


  7. On a terminal application, login to the device that you will add as an endpoint on you Portainer instance as root user:


  8. If you haven't already make sure to convert the standalone docker node to a swarm node by typing docker swarm init:


  9. Paste the command copied earlier on step #5:


  10. In a matter of seconds the Edge Agent will be installed. You can check if the edge agent has started successfully by typing docker ps on the terminal:


  11. You can now go back to Portainer, click on Home and you should see your endpoint associated to your instance and with the tags you selected when you added the endpoint:


  12. You can click on the endpoint to manage it with Portainer:

Hope that worked well for you, and you're up and running with Portainer. If you have any questions or comments, please drop them into the comments section below, or join us on our Slack channel.

Video walk through available here:

Comments