Skip to content

Add Edge Endpoint.

The edge agent was created as a way to manage an edge compute environment where devices typically lack the networking capability to run the traditional Portainer agent.

Expose port 8000.

This scenario only applies when Portainer is running in a Docker or Docker Swarm environment.

Portainer communicates with the edge agent over port 8000; through this port the edge agent can poll the Portainer instance, connect to Portainer, see when it is needed & initiate a tunnel or receive config updates. Without port 8000 exposed on Portainer, you cannot access the edge endpoint. If you already have Portainer deployed, you need to redeploy with port 8000 exposed alongside the port used to access Portainer. Using the CLI flag --tunnel-port you are able to set a different port if 8000 is already in use. For more information see CLI options.

  • Portainer with TLS: If your Portainer instance is deployed with TLS, the agent will use HTTPS for the connection it makes back to Portainer. This is the recommended approach.
  • Portainer with self-signed certs: If you are using a self-signed Portainer instance, the edge agent must be deployed with the flag: -e EDGE_INSECURE_POLL=1. If you do not deploy Portainer with this flag, then the agent will not be able to communicate with Portainer. This option is less secure than TLS.
  • Portainer fallback to HTTP: If Portainer is not configured with either of the above options, it will fallback to using HTTP for the agent polling. This option is no longer recommended, as it is insecure.

Deploying Edge agent in Docker Standalone environment.

To add an Edge Endpoint to Portainer: 1. Click Endpoints 2. Click Add Endpoint button.

edge

  1. Click Edge Agent 2. Assign friendly name 3. Set the Portainer Server URL indicating the Public IP of your Portainer instance and the port 4. Define a Pull Frequency (default is 5s) and 5. Click Add Endpoint

edge

In the next screen, 1. Select Docker Standalonein the tabbed Information section and then 2. Copy Command

edge

This command needs to be run in the Docker Standalone. Running docker ps should result in something similar to:

CONTAINER ID        IMAGE                            COMMAND             CREATED             STATUS              PORTS                    NAMES
b9e27f356de8        portainer/agent                  "./agent"           12 seconds ago      Up 12 seconds                                portainer_edge_agent

Next, in the Configuration section, 1. Define the IP address of the node you want to manage 2. Click Update Endpoint.

edge

You should then see the following pop up.

edge

Deploying Edge agent in Docker Swarm environment.

Adding a Docker Swarm environment with Edge Agent is very similar to the scenario with Docker Standalone.

To add an Edge Endpoint to Portainer: 1. Click Endpoints 2. Click Add Endpoint button.

swarm_edge

  1. Click Edge Agent 2. Assign friendly name 3. Set the Portainer Server URL indicating the Public IP of your Portainer instance and the port 4. Define a Pull Frequency (default is 5s) and 5. Click Add Endpoint

edge

In the next screen, 1. Select Docker Swarmin the tabbed Information section and then 2. Copy Command

edge

Run the command in the Docker Swarm node, expected results should look similar to:

cp2v1mqzkjpcroo3ama8wsve1
overall progress: 1 out of 1 tasks
okei8p76rf6k: running   [==================================================>]
verify: Service converged

Running docker service ls you should see:

ID                  NAME                   MODE                REPLICAS            IMAGE                    PORTS
cp2v1mqzkjpc        portainer_edge_agent   global              1/1                 portainer/agent:latest

Next, in the Configuration section, 1. Define the IP address of the node you want to manage 2. Click Update Endpoint.

edge

You should then see the following pop up:

edge

Deploying Edge agent in Kubernetes environment.

To add an Edge Endpoint to Portainer: 1. Click Endpoints 2. Click Add Endpoint button.

edge_kubernetes

  1. Click Edge Agent 2. Assign friendly name 3. Set the Portainer Server URL indicating the Public IP of your Portainer instance and the port 4. Define a Pull Frequency (default is 5s) and 5. Click Add Endpoint

edge_kubernetes

In the next screen, 1. Select Docker Swarmin the tabbed Information section and then 2. Copy Command.

You need to run this command in the Kubernetes host and the expected results is the following:

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  3190  100  3190    0     0   1249      0  0:00:02  0:00:02 --:--:--  1248
Downloading agent manifest...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  2070  100  2070    0     0   1582      0  0:00:01  0:00:01 --:--:--  1582
Creating Portainer namespace...
namespace/portainer created
Creating agent configuration...
configmap/portainer-agent-edge-id created
Creating agent secret...
secret/portainer-agent-edge-key created
Deploying agent...
Warning: kubectl apply should be used on resource created by either kubectl create --save-config or kubectl apply
namespace/portainer configured
serviceaccount/portainer-sa-clusteradmin created
clusterrolebinding.rbac.authorization.k8s.io/portainer-crb-clusteradmin unchanged
service/portainer-agent created
deployment.apps/portainer-agent created
Portainer Edge agent successfully deployed

You can validate if the Edge Agent is running in your host executing the following command:

 kubectl get pods --namespace=portainer

After running the command, you can enter the IP address of the host and click in Update Endpoint button.

edge_kubernetes

You should then see the following pop up:

||||| SPACE FOR POP UP |||||

Notes

Contribute to these docs.