Deploy The Portainer Agent
There are multiple ways to deploy the Portainer Agent. Deploying the Agent as a stack is the simplest method, however you can also install the Agent manually if desired. Connecting your Portainer instance to the Agent is required in order to make use of the Agent's features.
Deploy as a Stack
The simplest way to deploy the Agent is to use the Stacks feature of the the Portainer UI.
Within the web editor of Portainer's Stacks feature you can copy in the contents of the below stack file:
Alternatively, you can download this same stack file to your computer and upload it to Portainer when creating the Agent.
The file can be named whatever you wish as long as it has the .yml file extension.
Note: Portainer needs to be connected to the Agent before you can make use of the Agents features.
Deploy Manually
Note: This tutorial requires that you execute all commands on a manager node in your swarm.
Step 1: Create a new overlay network in your swarm cluster for the Agent by entering the following command:
Step 2: Instructions for step 2 are specific to your operating system. Users running Windows Server follow the special instructions for Windows Server
Enter the following command in your terminal to deploy the Agent as a global service in your cluster (connected to the overlay network you just created).
Note: Portainer needs to be connected to the Agent before you can make use of the Agents features.
Connecting Your Portainer Instance to The Agent
You need to add the Agent as an endpoint inside of Portainer before you can use the Agent's features.
Step 1: Navigate to the Endpoints view of the Portainer UI and click the Add Endpoint button.
Step 2: Click on the Agent Tab at the top of the page, fill in a name for your endpoint and the endpoint URL and click the Add Endpoint button.
Note: You will need to replace 10.0.7.10 with the IP of the node you have the Agent running on.
You should now see a green message such as the one below appear in the top right of the screen. This indicates the Agent has been successfully added as an endpoint.
You should also now have your Agent endpoint available to select & manage in the Home view of Portainer such as below.
Last updated
Was this helpful?