Generating API Tokens
We talk about the Polar Signals Agent here which for now is the same code as the Parca Agent.
Generating API Tokens to set up continuous profile collection (Polar Signals Agent)
An agent is set up through the use of the Polar Signals Agent which can be configured to continuously send profiles to the Polar Signals Cloud. In order to set up the Polar Signals Agent on a Kubernetes cluster, the user must first create an API token in the Polar Signals Cloud UI.
Generating an API Token
Usually, when creating a new organization or project you should be taken through our onboarding steps. One of those steps is generating the API token.
If you still need to generate an API token afterward head over to the "Settings" page of the project.
In the API Tokens section, enter a descriptive name for the token that will be generated and click “Create token”.
Upon successful creation, the contents of the token will appear in the text box below. This value can be copied simply by clicking on the text box. The token is only shown one time, so make sure to copy and save it in a secure location. Don't worry though, you can always generate more tokens if necessary.
A record of each of the tokens that have been created will appear in the table below the text box. If necessary, tokens can be removed by clicking the “Delete” button.
Note: The token created through the Polar Signals UI is a JSON Web Token (JWT). JWT is a secure way to send information between parties as a JSON object. The token contains multiple pieces of information to authenticate and validate the user, including the project id. This ensures that the profiles sent using the Polar Signals Agent configured with this token can be stored in the correct location. Full contents of the token can be viewed on jwt.io.
Using the generated token to set up a Polar Signals Agent
The Polar Signals Agent is an always-on sampling profiler used to capture raw profiling data. It can discover targets to profile through Kubernetes or systemd. When set up on a Kubernetes node, the Polar Signals Agent can discover containers in that node and continuously send profiles from these containers to the Polar Signals Cloud. Similarly, when set up using systemd, the Polar Signals Agent can discover systemd units on the node the agent is running on.
The following command can be run to set up the Polar Signals Agent via a CLI or through systemd on any Linux machine.
The token generated in the steps above should be provided in the command following the
--bearer-token flag, as can be seen in the example below.
sudo dist/parca-agent --node=test --log-level=debug --kubernetes=false --insecure --systemd-units=docker-b8873e261a9fb63e83d3d865a8780066e12e55b2f7eb8f6ac87db0b08444c6a8.scope --bearer-token eyJhbGciOiJFZERTQSJ9.eyJhdWQiOiI2ZmJiNjQwMy0yMDNkLTRhYjEtYjQ4Yy02ZGZiZmM2N2E2NzkiLCJpYXQiOjE2NTIzNTAxNzYwMzk4ODU0MDMsImlzcyI6Imh0dHBzOi8vYXBpLnBvbGFyc2lnbmFscy5jb20vIiwianRpIjoiNTdhYmJjZDAtNjdjNS00Y2Q2LWFlNmQtMTIxZTNkNjA5MTdhIiwicHJvamVjdElkIjoiNmZiYjY0MDMtMjAzZC00YWIxLWI0OGMtNmRmYmZjNjdhNjc5IiwidmVyc2lvbiI6IjEuMC4wIiwid3JpdGVQcm9maWxlcyI6dHJ1ZX0.OW16Shc4B48EW5TfYP9rggC7Pw9anu3yFd_vOoMqg2cwypBTlCDTOVvu6XtjNurxCUTJz24xXlzoS_Gyt18DAQ
Upon successful execution of this command, the agent should be set up to capture profiles and send them to the Polar Signals cloud. For more information on the Polar Signals Agent and how to explore collected data, see here: Kubernetes, systemd.