You can use parca-agent, part of Charmed Parca to gather profiles from a Canonical Kubernetes cluster. This document describes how.
This document assumes you already have deployed Canonical Kubernetes either from a snap or as a charm. It also assumes you have already deployed Parca alongside with COS-Lite. If you haven’t done so, see more: How to deploy Charmed Parca on top of COS-Lite
Get profiles from a charmed Canonical Kubernetes cluster
In the model where Parca is deployed, create an offer for the parca-store
endpoint:
juju offer parca:parca-store-endpoint parca-store
Switch to the machine model where Canonical Kubernetes is deployed, consume the offer you just created:
juju consume k8s:admin/cos.parca-store
Then deploy parca-agent:
juju deploy parca-agent --channel edge
And integrate:
juju integrate parca-agent parca-store
juju integrate parca-agent k8s
Now open grafana in a browser (in the cos model, run juju run grafana/leader get-admin-password
).
In Grafana’s Explore view, select the Parca datasource and verify there’s parca_agent
in the profiles tab. If you deployed COS on the same Kubernetes cluster that is being profiled, you should be able to see profiles from each of the applications that parca can natively instrument:
If you don’t see any profiles from parca-agent, check if your machine has all the requirements from How to autoinstrument machine workloads with parca-agent . If it does and you still don’t receive any profiles, check
juju debug-log
on the parca-agent charm and consider reaching out to us on Matrix or creating an issue inparca-agent-operator
.
Get profiles from a Canonical Kubernetes cluster deployed from a snap
As the parca-agent charm is a machine charm subordinate, you need to use the parca-agent snap directly to scrape profiles from a snapped Canonical Kubernetes cluster.
On the machine where Kubernetes snap is running, install the parca-agent
snap:
sudo snap install parca-agent --classic --channel edge
Then configure it to point at parca’s remote store address. You can find it by running juju status
on the k8s model where parca is deployed:
$ juju status
Model Controller Cloud/Region Version SLA Timestamp
test-parca microk8s microk8s/localhost 3.6.2 unsupported 12:13:14+01:00
App Version Status Scale Charm Channel Rev Address Exposed Message
(...)
parca active 1 parca-k8s 0 10.152.183.105 no UI ready at http://10.211.88.200:7994
Use the same IP address, but at port 7993
for the store address:
sudo parca-agent --node="k8s" --remote-store-address="10.211.88.200:7993" --remote-store-insecure
Observe in Grafana that the profiles from parca-agent
are available in the Parca datasource: