Kubernetes Discovery
Discover and map a Kubernetes cluster, including 30+ resource types and their dependencies, from an inline kubeconfig.
Overview
The Kubernetes collector is one of the most comprehensive discovery engines in AsPeekIt. It connects to a Kubernetes cluster using a standard kubeconfig file, enumerates over 30 resource types across all namespaces, and automatically maps the dependency relationships between them. Whether you are running a single development cluster or managing hundreds of production clusters, the Kubernetes collector provides full visibility into workloads, networking, storage, and RBAC configuration.
Connection Configuration
To configure a Kubernetes discovery zone, paste the kubeconfig content (YAML) and, optionally, a context name. Without a context AsPeekIt uses the current-context of the kubeconfig. For security the kubeconfig must be self-contained: file paths, file references (certificate-authority, client-certificate, client-key, tokenFile — use the inline *-data forms) and exec or auth-provider credential plugins are rejected. Use a client certificate or a static ServiceAccount token.
- kubeconfig (required): The full content of your kubeconfig YAML. Paste it directly into the field; a file path is rejected.
- context (optional): The kubeconfig context to use when the file defines several clusters.
- skip_namespaces (API only, default kube-system, kube-public, kube-node-lease): namespaces whose resources are not discovered.
- discover_crds, discover_gateway_api, parse_configmap_values, parse_secret_values (API only, all true by default): toggle CRD and Gateway API discovery and the parsing of ConfigMap and Secret values for connection strings.
Note: For EKS and GKE, exec-based authentication (aws eks get-token, gke-gcloud-auth-plugin) is not accepted: create a ServiceAccount token for AsPeekIt and put it in the kubeconfig as a static token. In-cluster discovery with the backend's own identity is available only when DISCOVERY_ALLOW_SERVER_CREDENTIALS is enabled on the server.
Discovered Resource Types
The Kubernetes collector discovers over 30 resource types across the core API groups and common extensions. Each resource is stored as an asset with its full spec and status metadata preserved in the attributes.
- Cluster: The cluster itself (k8s_cluster), with its version and API server endpoint
- Namespace: All namespaces with labels, annotations, and status
- Deployment: Replica count, strategy, selectors, and template spec
- ReplicaSet: Owner references, replica status, and pod template
- StatefulSet: Volume claim templates, update strategy, and ordinal index
- DaemonSet: Node selector, tolerations, and rolling update configuration
- Pod: Container images, resource requests/limits, node assignment, status, and restart count
- Service: Type (ClusterIP, NodePort, LoadBalancer, ExternalName), ports, and selectors
- Ingress: Rules, hosts, TLS configuration, and backend references
- ConfigMap: Data keys (values stored as metadata, not full content for security)
- Secret: Metadata only (type, labels, annotations). Secret data is never stored.
- PersistentVolumeClaim (PVC): Storage class, access modes, capacity, and bound volume
- PersistentVolume (PV): Capacity, reclaim policy, storage class, and claim reference
- StorageClass: Provisioner, parameters, and reclaim policy
- CronJob: Schedule expression, concurrency policy, and job template
- Job: Completions, parallelism, backoff limit, and completion status
- ServiceAccount: Associated secrets and image pull secrets
- Role / ClusterRole: Rules defining API group, resource, and verb permissions
- RoleBinding / ClusterRoleBinding: Subject-to-role mappings
- NetworkPolicy: Ingress and egress rules, pod selectors, and namespace selectors
- HorizontalPodAutoscaler (HPA): Target ref, min/max replicas, and metric specifications
- EndpointSlice: IP addresses and ports backing a service
- ResourceQuota: Hard limits and current usage per namespace
- LimitRange: Default and max resource constraints per namespace
- Node: OS, architecture, kubelet version, capacity, allocatable resources, and conditions
- PodDisruptionBudget (PDB): Min available, max unavailable, and selector
- CustomResourceDefinition (CRD): CRD names, group, versions, and scope (when discover_crds is enabled, the default)
- GatewayClass and Gateway (Gateway API): Gateway class, listeners, addresses, and attached routes
- HTTPRoute / TCPRoute / TLSRoute / GRPCRoute: Routing rules, backend refs, and parent gateway references
Dependency Mapping
The Kubernetes collector automatically detects and creates typed dependencies between discovered resources. These relationships power the topology graph and impact analysis features.
- Namespaces run on the cluster and nodes are managed by the cluster; top-level namespaced resources (Deployments, StatefulSets, DaemonSets, Jobs, CronJobs, Services, Ingresses, PVCs, unowned Pods) run on their namespace
- Pods run on the node they are scheduled on
- Workloads manage their Pods (owner references)
- Services load-balance to the workloads matched by their selector
- Ingresses and Gateway API routes (HTTPRoute and similar) route to their backend Services
- Pods depend on the PersistentVolumeClaims, ConfigMaps, Secrets and ServiceAccount they use; PVCs are bound to their PersistentVolume (storage)
- Connection strings found in Secrets and ConfigMaps (DATABASE_URL, Redis URLs…) create dependencies to the Kubernetes service they point to, and are kept on the workload so the correlation engine can link it to a database or service discovered in another zone (parse_secret_values and parse_configmap_values, on by default)

Required Permissions
AsPeekIt only needs read access to your cluster. Create a dedicated ServiceAccount with a ClusterRole that grants get, list, and watch permissions on the resource types you want to discover. The following ClusterRole definition covers all supported resource types.
Warning: Never grant write, create, update, patch, or delete permissions to the AsPeekIt service account. AsPeekIt performs strictly read-only operations during discovery.
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: idp-discovery-readonly
rules:
- apiGroups: ["", "apps", "batch", "networking.k8s.io", "gateway.networking.k8s.io", "storage.k8s.io", "rbac.authorization.k8s.io", "autoscaling", "policy", "discovery.k8s.io", "apiextensions.k8s.io"]
resources: ["*"]
verbs: ["get", "list", "watch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: idp-discovery-readonly-binding
subjects:
- kind: ServiceAccount
name: idp-discovery
namespace: idp-system
roleRef:
kind: ClusterRole
name: idp-discovery-readonly
apiGroup: rbac.authorization.k8s.ioTips and Best Practices
Keep these recommendations in mind when setting up Kubernetes discovery.
- Use a dedicated ServiceAccount per cluster rather than sharing a single kubeconfig across multiple clusters
- For large clusters (1000+ pods), set the discovery interval to 15 minutes or longer to avoid excessive API server load
- If you only need a subset of namespaces, consider using RBAC to scope the ServiceAccount to specific namespaces instead of cluster-wide access
- Rotate ServiceAccount tokens regularly and update the kubeconfig in the zone configuration
- Install agents on the nodes for host-level visibility (packages, connections, certificates)
- Leave parse_secret_values on to turn connection strings stored in Secrets into dependencies; secret values themselves are never stored
- If your cluster uses Gateway API instead of or alongside Ingress, ensure discover_gateway_api is enabled (it is by default)