zmoog / public-notes

Apache License 2.0
0 stars 1 forks source link

How to enroll a custom agent build in Fleet #61

Open zmoog opened 10 months ago

zmoog commented 10 months ago

Suppose you have a custom agent image and you want to enroll an agent in Fleet using that image.

During this test I will try with:

zmoog commented 10 months ago

Create an Agent Policy

Create the agent policy you want to use and copy the enrollment token for that policy.

zmoog commented 10 months ago

Enroll the Agent

#
# Store the enrollment token and Fleet URL in an environment variable.
#

# For example, UXg4Nzdvc0JsWUhmeC1CNjZKdTM6a1lKMzd6cVNSemluc1NlN1Q5YTE0UQ==
export ENROLLMENT_TOKEN="<TOKEN>" 

# For example, https://whatever.fleet.eastus2.azure.elastic-cloud.com
export FLEET_URL="<URL>"

# Enroll the Agent
docker run \
    --rm \
    --name="elastic-agent" \
    -e FLEET_ENROLL=true \
    -e FLEET_URL=${FLEET_URL} \
        -e FLEET_ENROLLMENT_TOKEN=${ENROLLMENT_TOKEN} \
        -i zmoog/elastic-agent:8.10.5-SNAPSHOT