# k8s-guardian [Health: Active]

**Category:** ☁️ Cloud Platforms  
**Repository:** https://github.com/andronaft/k8s-guardian  
**GitHub Stars:** 5  
**Views:** 0  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/k8s-guardian

## Description
Kubernetes guardrails that know your cluster: check and safely fix manifests, Helm charts and Kustomize, check cluster fit, and enforce the same rules as ValidatingAdmissionPolicy or Kyverno. CLI, kubectl plugin, GitHub Action, MCP server.

## Claude Desktop Quick Installation
No generated config for this server: it installs through its own setup steps.

The project's own setup steps (from https://github.com/andronaft/k8s-guardian), copied verbatim. Follow them in order; they are not an mcpServers config.

1. Install:

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

2. Install:

```sh
git clone https://github.com/andronaft/k8s-guardian && cd k8s-guardian && make build && sudo make install
```

## Documentation

## 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.

_Full upstream README: https://allmcps.com/mcp/k8s-guardian/readme_

