> For the complete documentation index, see [llms.txt](https://docs.pagerly.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pagerly.io/sre-ai-agent/data-sources/kubernetes.md).

# Kubernetes (Direct)

## What the Agent Can Do

* List and inspect pods — status, restart counts, OOM kills
* List deployments, replica sets, and stateful sets
* Get pod logs and events
* Check node status and resource usage
* Inspect services, configmaps, and secrets metadata

## Setup Instructions

1. Get your Kubernetes API server URL (e.g., from `kubectl cluster-info`)
2. Create a service account with read permissions:

```bash
kubectl create serviceaccount pagerly -n default
```

3. Get the service account token:

```bash
kubectl create token pagerly -n default
```

4. Paste the API server URL and token in the Pagerly dashboard

## Required Credentials

| Field                     | Description                 | Example                               |
| ------------------------- | --------------------------- | ------------------------------------- |
| **Kubernetes API URL**    | Your K8s API server URL     | `https://kubernetes.example.com:6443` |
| **Service Account Token** | Token with read permissions | `eyJhbGciOiJSUzI1NiIs...`             |

{% hint style="info" %}
**Prefer the Agent-based approach?** If you don't want to expose your K8s API externally, use the [Kubernetes (Agent)](/sre-ai-agent/data-sources/kubernetes-agent.md) integration instead — it connects outbound from your cluster with no firewall changes needed.
{% endhint %}

## Context Prompt Tips

> *"Production namespace is prod. Critical deployments: api, worker, web. Use app label for service identification."*

## Docs

* [Kubernetes API Reference](https://kubernetes.io/docs/reference/kubernetes-api/)
