Skip to main content

Kubernetes Cluster Discovery Reference

This document provides a comprehensive reference for Kubernetes cluster discovery in Tripl-i. The Kubernetes scanner connects to the K8s API server to discover cluster topology, nodes, workloads, services, and ingress configurations — providing complete visibility into containerized infrastructure.

Overview

The Kubernetes scanner (kubernetes_scanner.py) discovers and maps Kubernetes cluster infrastructure via the standard Kubernetes API. It collects cluster metadata, node inventory, deployment and statefulset workloads, services, and ingress routing rules. The scanner follows the same opt-in pattern as vCenter — it is triggered when port 6443 is detected during a network scan.

Key Benefits

  • Complete Cluster Visibility — Automatically discover all nodes, workloads, services, and ingresses across namespaces
  • Node-to-Server Correlation — Kubernetes nodes are matched to existing Server CIs discovered via WMI or SSH, enriching them with K8s metadata
  • Workload Inventory — Track every Deployment, StatefulSet, and DaemonSet with replica counts, container images, and resource requests
  • Service Mapping — Map ClusterIP, NodePort, and LoadBalancer services to their backing workloads
  • Ingress Routing — Discover external access paths including hostnames, TLS configuration, and backend routing
  • Dependency Mapping — Automatically build relationships between cluster, nodes, workloads, and services

Network Ports and Protocols

Kubernetes API Communication

PortProtocolPurpose
6443TCP/HTTPSKubernetes API server (required)

Discovery Trigger

The Kubernetes scanner is automatically triggered when:

  • Port 6443 is detected as open during network scanning
  • Kubernetes credentials are configured for the target IP range
  • The kubernetes protocol is enabled in the scan configuration

Kubernetes scanning is opt-in (disabled by default). Enable it in the scan configuration when you have K8s clusters to discover. This prevents unnecessary scanning noise on non-Kubernetes hosts.

Authentication Requirements

Credential Options

The scanner supports three authentication methods, tried in priority order:

MethodWhen to UseWhat to Provide
Bearer TokenMost common — service account tokenToken string + API server URL
Kubeconfig FileWhen you have an existing kubeconfigPath to kubeconfig file
In-Cluster ConfigAgent running as a K8s podNothing — automatic detection

Creating a Service Account Token

To create a read-only service account for discovery:

kubectl create serviceaccount nopesight-scanner -n kube-system

kubectl create clusterrolebinding nopesight-scanner \
--clusterrole=view \
--serviceaccount=kube-system:nopesight-scanner

kubectl create token nopesight-scanner -n kube-system --duration=8760h

The built-in view ClusterRole provides read-only access to all resources the scanner needs.

Required API Permissions

The scanner only performs read operations. It never creates, modifies, or deletes any Kubernetes resources. The following API calls are made:

API CallPurpose
GET /versionCluster version information
GET /api/v1/nodesNode inventory
GET /api/v1/namespacesNamespace count
GET /api/v1/podsPod counts per node
GET /api/v1/servicesService discovery
GET /apis/apps/v1/deploymentsDeployment workloads
GET /apis/apps/v1/statefulsetsStatefulSet workloads
GET /apis/apps/v1/daemonsetsDaemonSet workloads
GET /apis/networking.k8s.v1/ingressesIngress routing rules

Configuring Credentials in the Scanner Agent

In the Nopesight Scanner GUI:

  1. Navigate to the Credentials tab
  2. Select protocol: Kubernetes
  3. Set IP Range to your API server IP (e.g., 10.0.1.100)
  4. Fill in one of:
    • Bearer Token — paste the service account token
    • Kubeconfig — browse to the kubeconfig file path
  5. Set Server URL (e.g., https://10.0.1.100:6443) — optional if using kubeconfig
  6. Verify SSL — leave unchecked for self-signed certificates
  7. Click Save

Data Collection Overview

What Gets Discovered

Kubernetes Cluster
|
+--- Cluster Info (version, platform, node/namespace counts)
|
+--- Nodes
| +--- Addresses (InternalIP, Hostname)
| +--- Capacity & Allocatable Resources (CPU, memory, pods)
| +--- Conditions (Ready, MemoryPressure, DiskPressure)
| +--- Labels & Roles (worker, control-plane)
| +--- Node Info (kubelet version, OS image, container runtime, systemUUID)
| +--- Pod Count
| +--- Provider ID (AWS, Azure, GCP instance reference)
|
+--- Workloads
| +--- Deployments (replicas, images, resources, strategy)
| +--- StatefulSets (replicas, images, volume claims)
| +--- DaemonSets (desired/ready counts)
|
+--- Services
| +--- ClusterIP, NodePort, LoadBalancer types
| +--- Ports, selectors, external IPs
|
+--- Ingresses
+--- Rules (hostnames, paths, backends)
+--- TLS configuration
+--- Ingress class

Cluster Information

Data PointDescription
Kubernetes versionAPI server version (e.g., "1.28.4")
PlatformBuild platform (e.g., "linux/amd64")
Node countTotal nodes in cluster
Namespace countTotal namespaces
API server URLCluster endpoint
Git versionFull version string

Node Details

For each node in the cluster:

Data PointDescription
NameNode hostname
Internal IPNode IP address within the cluster network
HostnameDNS hostname
CPU capacityTotal CPU cores available
Memory capacityTotal memory (e.g., "32Gi")
Pod capacityMaximum pods schedulable
Allocatable resourcesResources available after system reservations
Ready conditionWhether the node is healthy
Memory/Disk/PID pressureResource pressure conditions
Rolescontrol-plane, worker, or custom roles
Kubelet versionNode agent version
Container runtimeRuntime engine (e.g., "containerd://1.7.8")
OS imageOperating system (e.g., "Ubuntu 22.04.3 LTS")
Kernel versionLinux kernel version
System UUIDHardware UUID (used for cross-referencing with WMI/vCenter)
Provider IDCloud provider instance ID (e.g., aws:///eu-central-1a/i-0abc123)
Pod countNumber of pods running on this node
LabelsAll Kubernetes labels (instance type, zone, custom labels)

Workload Details

For each Deployment, StatefulSet, and DaemonSet:

Data PointDescription
KindDeployment, StatefulSet, or DaemonSet
NameWorkload name
NamespaceKubernetes namespace
Desired replicasTarget replica count
Ready replicasCurrently ready replicas
Available replicasAvailable for traffic
Container imagesDocker/OCI images used (with tags)
LabelsWorkload labels (app, tier, version, etc.)
Resource requestsCPU and memory requests per container
Resource limitsCPU and memory limits per container
Update strategyRollingUpdate, Recreate, or OnDelete
Volume claimsPersistent volume claims (StatefulSets) with storage class and size
Created atWorkload creation timestamp

Service Details

For each Kubernetes Service:

Data PointDescription
NameService name
NamespaceKubernetes namespace
TypeClusterIP, NodePort, LoadBalancer, or ExternalName
Cluster IPInternal service IP
External IPLoadBalancer IP/hostname (if applicable)
PortsPort mappings (port, targetPort, nodePort, protocol)
SelectorLabel selector linking to workload pods

Ingress Details

For each Ingress resource:

Data PointDescription
NameIngress name
NamespaceKubernetes namespace
Ingress classController class (nginx, traefik, alb, etc.)
RulesHost-based routing rules with path matching
Backend servicesService name and port for each path
TLS enabledWhether TLS termination is configured
TLS hostsHostnames covered by TLS certificates
Secret namesTLS certificate secret references

What Gets Created in Tripl-i

Configuration Items

CI TypeCreated FromKey Fields
Kubernetes ClusterCluster infoversion, platform, node count, namespace count, API server URL
Kubernetes WorkloadEach Deployment/StatefulSet/DaemonSetkind, namespace, replicas, images, resources, labels
Kubernetes IngressEach Ingress resourceingress class, rules, TLS config, hostnames
Server (enriched)Nodes matched to existing CIsK8s node role, kubelet version, pod capacity, conditions, labels

Node-to-Server Correlation

One of the most powerful features of Kubernetes discovery is cross-scanner correlation. When the backend processes K8s scan data, it attempts to match each node to an existing Server CI that was previously discovered via WMI, SSH, or vCenter:

Match MethodWhat It ComparesUse Case
System UUIDNode systemUUID vs CI serialNumberVMware VMs (handles both UUID and BIOS serial formats)
Provider IDAWS instance ID from providerID vs CI customFields.instance_idAWS EC2 instances
Internal IPNode IP vs CI ipAddressGeneral IP matching
HostnameNode hostname vs CI name (case-insensitive)Fallback matching

When a match is found, the existing Server CI is enriched with Kubernetes metadata — no duplicate CI is created. When no match is found, a new Server CI is created with the K8s node data.

Kubernetes-Specific CI Fields

After processing, CIs gain these additional fields:

Cluster CI (customFields):

  • k8s_version — Kubernetes version
  • k8s_platform — Build platform
  • k8s_node_count — Number of nodes
  • k8s_namespace_count — Number of namespaces
  • k8s_api_server — API server URL

Workload CI (customFields):

  • k8s_namespace — Kubernetes namespace
  • k8s_kind — Deployment, StatefulSet, or DaemonSet
  • k8s_replicas_desired / k8s_replicas_ready — Replica counts
  • k8s_images — Container images (JSON array)
  • k8s_labels — Kubernetes labels
  • k8s_resources — Resource requests and limits
  • k8s_strategy — Update strategy
  • k8s_volume_claims — PVC details (StatefulSets)
  • k8s_service_name — Matching service name (if any)
  • k8s_service_type — Service type (ClusterIP, LoadBalancer, etc.)
  • k8s_service_ports — Service port mappings
  • k8s_external_ip — External access IP

Ingress CI (customFields):

  • k8s_ingress_class — Ingress controller class
  • k8s_ingress_rules — Routing rules (JSON)
  • k8s_tls_enabled — TLS termination flag
  • k8s_tls_hosts — TLS hostnames
  • k8s_namespace — Kubernetes namespace

Server CI (node enrichment, customFields):

  • k8s_node_role — Node role (worker, control-plane)
  • k8s_kubelet_version — Kubelet agent version
  • k8s_pod_capacity — Maximum pods
  • k8s_conditions — Node health conditions
  • k8s_labels — Node labels

Relationships Created

RelationshipSourceTargetDescription
containsKubernetes ClusterServer (node)Cluster contains this node
containsKubernetes ClusterKubernetes WorkloadCluster contains this workload
containsKubernetes ClusterKubernetes IngressCluster contains this ingress
runs_onKubernetes WorkloadServer (node)Workload pods run on this node
routes_toKubernetes IngressKubernetes WorkloadIngress routes traffic to workload
servesServiceKubernetes WorkloadService fronts this workload

Architecture Decisions

What Becomes a CI vs. What Doesn't

K8s ObjectCI?Rationale
ClusterYes — Kubernetes ClusterTop-level infrastructure component
NodeEnriches existing Server CINodes are physical/virtual servers — not separate CI type
Deployment / StatefulSet / DaemonSetYes — Kubernetes WorkloadRepresents a deployable application unit
IngressYes — Kubernetes IngressRepresents external access configuration
ServiceMetadata on Workload CIServices are networking abstractions, not standalone infrastructure
PodNoEphemeral — pods come and go constantly
NamespaceNoOrganizational grouping, not infrastructure
ConfigMap / SecretNoConfiguration data, not discoverable infrastructure

Why Services Are Not Separate CIs

Kubernetes Services are label-based routing abstractions. Rather than creating thousands of Service CIs that have a 1:1 relationship with workloads, service metadata (name, type, ports, external IP) is attached directly to the matching Workload CI as custom fields. This keeps the CMDB focused on meaningful infrastructure components.


Discovery Logging

Kubernetes scan results appear in Discovery Logs with scan type kubernetes. A successful scan log includes:

  • Scan Type: kubernetes
  • Status: success
  • Discovery Status: "Kubernetes cluster discovered"
  • Result Summary: Node count, workload count, service count, data size

Failed scans show the specific error (authentication failure, API unreachable, missing permissions).

Performance Considerations

FactorTypical Value
Scan duration (small cluster, fewer than 10 nodes)15-30 seconds
Scan duration (medium cluster, 10-50 nodes)30-60 seconds
Scan duration (large cluster, 50+ nodes)60-120 seconds
Timeout120 seconds

Scan duration depends primarily on the number of pods (for per-node pod counting) and the number of workloads across all namespaces.

Security Considerations

  • Read-only access — The scanner never creates, modifies, or deletes K8s resources
  • Service account tokens — Use dedicated service accounts with minimal view permissions
  • Token rotation — Create time-limited tokens with --duration flag
  • TLS verification — Can be enabled for production clusters with valid certificates
  • No secrets accessed — The scanner does not read ConfigMaps, Secrets, or pod logs
  • Namespace isolation — The scanner lists resources across all namespaces but only collects metadata

Troubleshooting

Common Issues

SymptomCauseResolution
"Port 6443 not open"API server not reachableVerify network connectivity and firewall rules
"All Kubernetes credentials failed"Invalid or expired tokenRegenerate the service account token
"Forbidden" errorsInsufficient permissionsVerify the ClusterRoleBinding is correctly configured
"Certificate verify failed"Self-signed certificateUncheck "Verify SSL" in credential configuration
Scanner skips K8sProtocol not enabledEnable kubernetes in scan protocol settings
"kubernetes Python package not installed"Missing dependencyRun pip install kubernetes on the scanner agent

Verifying Connectivity

Test from the scanner agent machine:

curl -k https://API_SERVER_IP:6443/version

If this returns a JSON version response, the API server is reachable.

Next Steps