Hamburger Cross Icon
Kubernetes Collector - Lunar Collector

Kubernetes Collector

Collector Stable OrchestrationContainers

Parse Kubernetes YAML manifests to extract workloads, containers, resource limits, probes, PodDisruptionBudgets, and HorizontalPodAutoscalers.

Add k8s to your lunar-config.yml:
uses: github://earthly/lunar-lib/collectors/k8s@v1.0.0

What This Integration Collects

This integration includes 1 collector that gather metadata from your systems.

Collector code

k8s

Parses all Kubernetes manifests in the repository using kubeconform validation and collects:

  • Manifest validity and parse errors
  • Workloads (Deployments, StatefulSets, DaemonSets, Jobs, CronJobs)
  • Container specs with resource requests/limits and probes
  • PodDisruptionBudgets (PDBs)
  • HorizontalPodAutoscalers (HPAs)
kubernetes k8s deployment pods containers resources probes pdb hpa
Book a demo

How Collectors Fit into Lunar

Lunar watches your code and CI/CD systems to collect SDLC data from config files, test results, IaC, deployment configurations, security scans, and more.

Collectors are the automatic data-gathering layer. They extract structured metadata from your repositories and pipelines, feeding it into Lunar's centralized database where guardrails evaluate it to enforce your engineering standards.

Learn How Lunar Works
1
Collectors Gather Data This Integration
Triggered by code changes or CI pipelines, collectors extract metadata from config files, tool outputs, test results, and scans
2
{ } Centralized as JSON
All data merged into each component's unified metadata document
3
Guardrails Enforce Standards
Real-time feedback in PRs and AI workflows

Example Collected Data

This collector writes structured metadata to the Component JSON. Here's an example of the data it produces:

{ } component.json Component JSON
{
  "k8s": {
    "source": {
      "tool": "kubeconform",
      "version": "0.6.7"
    },
    "manifests": [
      {
        "path": "deploy/deployment.yaml",
        "valid": true,
        "resources": [
          {"kind": "Deployment", "name": "payment-api", "namespace": "payments"}
        ]
      }
    ],
    "workloads": [
      {
        "kind": "Deployment",
        "name": "payment-api",
        "namespace": "payments",
        "path": "deploy/deployment.yaml",
        "replicas": 3,
        "containers": [
          {
            "name": "api",
            "image": "gcr.io/acme/payment-api:v1.2.3",
            "has_resources": true,
            "has_requests": true,
            "has_limits": true,
            "cpu_request": "100m",
            "cpu_limit": "500m",
            "memory_request": "128Mi",
            "memory_limit": "512Mi",
            "has_liveness_probe": true,
            "has_readiness_probe": true,
            "runs_as_non_root": true,
            "read_only_root_fs": true,
            "privileged": false
          }
        ]
      }
    ],
    "pdbs": [
      {
        "name": "payment-api-pdb",
        "namespace": "payments",
        "path": "deploy/pdb.yaml",
        "target_workload": "payment-api",
        "min_available": 2
      }
    ],
    "hpas": [
      {
        "name": "payment-api-hpa",
        "namespace": "payments",
        "path": "deploy/hpa.yaml",
        "target_workload": "payment-api",
        "min_replicas": 3,
        "max_replicas": 10
      }
    ]
  }
}

Configuration

Configure this collector in your lunar-config.yml.

Inputs

Input Required Default Description
find_command Optional git ls-files '*.yaml' '*.yml' Command to find K8s manifest files (must output one file path per line)

Documentation

View on GitHub

Kubernetes Collector

Parses Kubernetes manifests and collects workload, PodDisruptionBudget, and HorizontalPodAutoscaler metadata.

Overview

This collector finds all Kubernetes YAML manifests in a repository and validates them using kubeconform. It extracts structured information about workloads (Deployments, StatefulSets, DaemonSets, Jobs, CronJobs), their container specifications including resource limits and probes, PodDisruptionBudgets, and HorizontalPodAutoscalers. The collector runs on code changes and outputs normalized data for K8s-related policies.

Collected Data

This collector writes to the following Component JSON paths:

Path Type Description
.k8s.source object Tool metadata (tool name and version)
.k8s.manifests[] array Parsed K8s manifests with validity and resources
.k8s.workloads[] array Workload resources with container specs
.k8s.pdbs[] array PodDisruptionBudgets
.k8s.hpas[] array HorizontalPodAutoscalers

Collectors

This integration provides the following collectors (use include to select a subset):

Collector Description
k8s Collects Kubernetes manifests, workloads, PodDisruptionBudgets, and HorizontalPodAutoscalers

Installation

Add to your lunar-config.yml:

collectors:
  - uses: github://earthly/lunar-lib/collectors/k8s@v1.0.0
    on: ["domain:your-domain"]  # Or use tags like [kubernetes, backend]
    # with:
    #   find_command: "find ./deploy -name '*.yaml'"  # Custom find command

Open Source

This collector is open source and available on GitHub. Contribute improvements, report issues, or fork it for your own use.

View Repository

Ready to Automate Your Standards?

See how Lunar can turn your engineering wiki, compliance docs, or postmortem action items into automated guardrails with our 100+ built-in guardrails.

Works with any process
check Infrastructure conventions
check Post-mortem action items
check Security & compliance policies
check Testing & quality requirements
Automate Now
Turn any process doc into guardrails
Book a Demo