Connect your Prometheus instance to Ankra to view metrics directly in the platform. This powers resource graphs, the AI Assistant’s metrics awareness, and cluster health indicators.
Why Connect Prometheus?
When you connect Prometheus to Ankra:- Resource Metrics - View CPU, memory, and network graphs on pods, deployments, and nodes
- AI-Powered Analysis - The AI Assistant can query your metrics to diagnose issues
- Cluster Overview - See aggregate metrics on the cluster dashboard
- Troubleshooting - Correlate metrics with logs and events in one place
Supported Endpoints
Ankra connects to any Prometheus-compatible endpoint:
Amazon Managed Prometheus, Google Cloud Managed Prometheus and Azure Monitor appear in the connection dialog but cannot be selected yet.
Connecting Prometheus
1
Open Integrations
Navigate to your cluster → Settings → Integrations.
2
Select Metrics
Choose Metrics in the sidebar.
3
Pick a provider
Under Provider, select Prometheus for a self-hosted instance, or Grafana Cloud / Mimir or VictoriaMetrics for a hosted Prometheus-compatible endpoint. The managed cloud providers (AWS, Google, Azure) are marked Coming soon.
4
Enter the endpoint
Click Connect Existing and enter your Prometheus endpoint URL. For a self-hosted Prometheus, Ankra also scans the cluster for Prometheus services and offers the ones it finds.For in-cluster Prometheus, use the internal service URL:For kube-prometheus-stack:
5
Add credentials (if required)
If your Prometheus requires authentication, expand Authentication, enter a Credential Name, and pick the Authentication Method:
- API Token - For bearer token authentication
- User Account - For basic auth (username/password)
6
Test and save
Click Test Connection to verify Ankra can reach your Prometheus instance, then Submit to store the configuration.
Authentication Options
- No Authentication
- API Token
- Basic Auth
For Prometheus instances without authentication (common for in-cluster deployments):
Simply enter the endpoint URL and save. No credentials needed.
In-Cluster vs External Prometheus
In-Cluster Prometheus
If Prometheus runs inside the same cluster:- Use the internal Kubernetes service URL
- No authentication is typically needed
- The Ankra agent forwards requests through the cluster network
External Prometheus
If Prometheus runs outside the cluster (cloud managed, separate infrastructure):- Use the external URL (must be reachable from your cluster)
- Configure authentication as required by your provider
- Ensure network connectivity and firewall rules allow access
Credentials
In the portal, the credential is created with the metrics source, in the Authentication section of the form:- Credential Name - A descriptive name like
prometheus-prod - Authentication Method - API Token for bearer token auth, User Account for basic auth
A saved credential cannot be edited in place. To rotate a token or password, delete the credential from Settings → Integrations → Metrics and create a new one.To keep the gap short, rotate Prometheus first, then Ankra: once the new secret is live on the Prometheus side, open Edit on the metrics source, type the new credentials into the Authentication section and click Test Connection. The test uses what you typed without saving it, so a green result proves the new secret opens the door before you replace the saved credential. Queries fail with a 401 for the time between Prometheus dropping the old secret and Ankra receiving the new one.
Rotating by API
To rotate from a script, send the cluster’s import request with only the new credential. The call replaces the saved metrics credential and leaves everything else on the cluster as it is - as long as the body carries nostacks, because a stack in the body replaces the saved stack of that name.
- Use a REST token - a personal access token created without
--scopes, or a service token with no MCP scope, whose role can change the cluster. A token withmcp:readormcp:writeis refused with403. - Send the whole block.
name,usernameandpasswordfor basic auth, ornameandtokenfor bearer auth. An omittedusernameis saved as empty and basic auth stops working. - Keep the name the Metrics panel shows, so the old secret is overwritten rather than left behind.
- Use
wait=true, so the call answers with the outcome - check itserrorslist - instead of202before the work is done. - If the call answers
422 Failed to push changes to Git repository, the credential is already saved: Ankra has not yet synced your latest commit to the cluster’s repository. Do not retry; check with the query below.
ankra cluster apply and the Git sync both ignore a prometheus_credential block. To check the whole path afterwards - the saved credential, the agent and Prometheus - run ankra cluster metrics query 'up' against the cluster. Results are cached for ten seconds.
Managing the Connection in Git
If the cluster is connected to a GitOps repository, the metrics data source is part of the cluster document atclusters/<cluster-name>-<cluster-id>/<cluster-name>.yaml. Adding or editing the spec.prometheus_metrics block connects and updates the source on the next sync, exactly as the settings page does:
endpoint, credential_name, flavor and verify_ssl - see the ImportCluster schema for what each one means. Any other top-level field is refused with an error naming it, rather than ignored. A block without credential_name keeps using the credential already saved on the cluster, if there is one; the Metrics panel under Settings → Integrations shows which.
Verifying the Connection
After connecting Prometheus:- Check Integrations - The Metrics entry in the sidebar shows a green dot, and the panel shows the last health check
- View Resource Metrics - Go to any pod or deployment and check for metric graphs
- Ask the AI - Press
⌘+Jand ask “What’s the CPU usage of this pod?”
- Verify the endpoint URL is correct
- Check that Prometheus has data for your cluster
- Re-test the connection from Settings → Integrations → Metrics → Edit
- Check network connectivity between your cluster and Prometheus
Troubleshooting
Connection Test Fails
Connection Test Fails
- Verify the URL is correct and includes the port
- For in-cluster Prometheus, ensure the service exists:
- Check if Prometheus is running:
- Test connectivity from within the cluster:
Authentication Errors
Authentication Errors
- Verify the credential is correctly configured
- For API tokens, ensure the token hasn’t expired
- For basic auth, verify the username and password are correct
- Check Prometheus logs for authentication failures
Metrics Not Appearing
Metrics Not Appearing
- Prometheus may not have metrics for the resource yet (wait for scrape interval)
- Verify Prometheus is scraping the correct targets
- Check the Prometheus UI targets page for scrape errors
- Ensure the metric names match what Ankra expects (standard Kubernetes metrics)
Slow Queries
Slow Queries
- Large time ranges can be slow. Try narrower ranges.
- Consider using recording rules for frequently-queried metrics
- Check Prometheus resource usage (may need more CPU/memory)
What Metrics Does Ankra Use?
Ankra queries standard Kubernetes and node metrics:
If you’re using kube-prometheus-stack, all these metrics are included by default.
Next Steps
Build a Monitoring Stack
Deploy Prometheus and Grafana with one Stack.
AI Assistant
Use the AI to query and analyze your metrics.
Kubernetes Insights
Explore built-in cluster dashboards.
Credentials
Manage authentication for all integrations.