K8s Guardian logo

K8s Guardian

Inspect and safely fix Kubernetes workloads, compare changes with live clusters, and apply consistent admission rules.

Install K8s Guardian

Run the project’s own setup commands, in order.

Setup steps from the project

k8s-guardian installs with its own steps rather than a config we can generate, so these are copied as-is. Follow them in order and run the commands in a terminal. Source: github.com

  1. 1. Install
    go install github.com/andronaft/k8s-guardian/cmd/k8s-guardian@latest
    
  2. 2. Install
    git clone https://github.com/andronaft/k8s-guardian && cd k8s-guardian && make build && sudo make install
    

Overview

k8s-guardian MCP server brings Kubernetes manifest checks and remediation into MCP-compatible developer workflows. It works across YAML manifests, Helm charts, Kustomize overlays, and live cluster context, with checks for workload security, resources, references, APIs, and deployment fit. The underlying binary also supports breaking-change diffs, custom rules, and exporting matching ValidatingAdmissionPolicy or Kyverno policies. Reach for it when an agent needs to review Kubernetes changes before deployment or apply conservative fixes.

Use cases

  • Review Kubernetes manifests before merging
  • Fix safe workload configuration issues automatically
  • Check whether deployments fit a target cluster
  • Compare proposed resources with what is deployed
  • Export matching admission policies

Key features

  • Manifest, Helm, and Kustomize validation
  • Safe automatic fixes
  • Live cluster fit checks
  • Breaking-change detection
  • Custom YAML rules
  • ValidatingAdmissionPolicy and Kyverno export

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked

Recent health check succeeded.

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars5Stargazers on the source repository.
Last commit4d agoMost recent push to the default branch.

How K8s Guardian works

What k8s-guardian does

k8s-guardian packages Kubernetes guardrails in a single binary that can be used as a CLI, kubectl plugin, GitHub Action, or MCP server. The MCP entry point is intended for Claude Code and Cursor workflows, allowing an agent to work with the same Kubernetes validation capabilities available elsewhere in the project.

Its checks cover common workload and platform risks, including missing CPU or memory requests, privileged containers, privilege escalation, unsafe capabilities, missing probes, mutable :latest image tags, host namespaces and ports, seccomp settings, literal secrets in environment variables, Service wiring, PodDisruptionBudgets, removed APIs, and wildcard RBAC permissions. The rule set includes 21 built-in rules and can be extended with YAML rules rather than Rego.

How it works

The tool accepts files, directories, Helm charts, and Kustomize overlays. Helm checks can use supplied values files, so rendered output can be evaluated for a target environment. Safe fixes can be applied while preserving comments and leaving unaffected YAML unchanged byte for byte. More disruptive fixes require an explicit unsafe-fixes option.

When a kubeconfig and cluster context are available, live checks compare proposed workloads with cluster conditions. These checks cover ResourceQuota headroom, node capacity, LimitRanges, missing ConfigMaps and Secrets, and required CRDs. A separate diff operation identifies changes that may break an existing deployment, such as immutable selectors, removed APIs, downtime risks, or port changes.

Rules can also be exported for enforcement at admission time as ValidatingAdmissionPolicy or Kyverno policies. The project describes these exports as using the same decisions as the CLI.

Setup and configuration

Install the binary with Go 1.26 or newer:

bash
go install github.com/andronaft/k8s-guardian/cmd/k8s-guardian@latest

The project also publishes Linux, macOS, and Windows binaries, provides a multi-architecture container image, and supports installation from source. After installation, the MCP entry point is started with:

bash
k8s-guardian mcp

The broader command set includes check, diff, export, and init. Configuration can be stored in .k8s-guardian.yaml; a baseline lets an existing repository fail only on findings introduced after adoption. Custom rules can be placed under .k8s-guardian/rules/ or supplied with --rules.

Tools and capabilities

  • Review manifests, Helm output, and Kustomize overlays against built-in or custom rules.
  • Apply safe fixes automatically, with additional risky fixes available through an opt-in flag.
  • Check whether workloads fit a live namespace and cluster.
  • Compare proposed resources with deployed resources for breaking changes.
  • Export guardrails for ValidatingAdmissionPolicy or Kyverno enforcement.
  • Use the MCP entry point from Claude Code or Cursor.

Limitations and notes

The MCP server is part of a larger Kubernetes tooling binary, so installation provides more than the MCP entry point. Live analysis requires access to a kubeconfig and target cluster. AI-assisted fixes are optional and require an API key. Cost estimation, the interactive review TUI, and plain-language rule creation are marked experimental, and their output or flags may change.

Written by AllMCPs with AI assistance from the project’s README and listing data. How we build listings

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about K8s Guardian

k8s-guardian is an MCP server that connects AI developer workflows with Kubernetes manifests, Helm charts, Kustomize overlays, and live cluster context. Its main tools support workload checks, safe fixes, cluster-fit analysis, breaking-change detection, and consistent rule enforcement through exported admission policies.

Install k8s-guardian with Go 1.26 or newer, a release binary, Docker, or from source, then start the MCP entry point with `k8s-guardian mcp`. The project publishes binaries for Linux, macOS, and Windows.

Yes, k8s-guardian lists Cursor as a supported MCP client. Its MCP entry point is also documented for Claude Code, and the binary is started with `k8s-guardian mcp`.

Yes, live checks use kubeconfig and a target namespace to evaluate cluster fit. They inspect quota headroom, node capacity, LimitRanges, missing ConfigMaps or Secrets, and required CRDs.

Yes, `check --fix` applies safe fixes automatically while preserving comments and unchanged YAML. Riskier changes require an explicit unsafe-fixes option, and AI-assisted fixes are available optionally with an API key.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewK8s Guardian AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/k8s-guardian?style=directory)](https://allmcps.com/mcp/k8s-guardian)
HTML Embed
<a href="https://allmcps.com/mcp/k8s-guardian"><img src="https://allmcps.com/api/badge/k8s-guardian?style=directory" alt="K8s Guardian on AllMCPs" /></a>