A terminal UI for Kubernetes policy engines — in the spirit of k9s.
Browse policies, violations, admission denials and engine health for OPA Gatekeeper, Kyverno and native ValidatingAdmissionPolicies, side by side, straight from your kubeconfig.
Install · Quick start · Features · Docs · Contributing
p9s-demo.mp4
A blocked deploy traced to its Gatekeeper policy, fix and impact, then every view, RBAC, snapshots and the CI gate (full quality). Prefer the terminal recording? Here it is.
p9s answers the questions a platform or security team asks every day:
- 🩺 Is the policy layer working? Fail-open webhooks with no endpoints, expiring certificates, crash-looping controllers, stale audits, policies that never loaded.
- 👥 What is violating what, and whose is it? Violations grouped by the Deployment or CronJob that owns them.
- 💥 What would break if this policy enforced? The objects a policy would reject today, by namespace and owner.
- 🚫 What was just blocked? Recent admission denials, with the user who made the request where the engine records it (Gatekeeper does; Kyverno's Events do not).
- 🛠️ How do I fix it? A violation's detail carries the policy's own remediation text.
- 📄 Can I hand this to security?
p9s reportwrites Markdown, HTML or JSON with every violation and the health findings.
And it stays out of the way:
- 🔒 Read-only. Nothing to install in the cluster; p9s never creates, changes or deletes anything.
- ⚡ Live. Informers, not polling, with trimmed caches.
- 🔐 RBAC-aware. Works with whatever you may read, down to a single namespace, and says what it could not see.
- 📸 Offline. Record a snapshot and browse it anywhere, or run the same
views as
p9s getin scripts and CI.
| 🩺 Health dashboard | Webhooks (failure policy, ready endpoints, certificate expiry), controllers, audit freshness and policies that never loaded, worst first. |
| 👥 Violations by owner | A Deployment with 30 violating Pods is one row; o (or get v --flat) lists every violation. |
| 🛠️ How to fix | A violation's detail carries the policy's own remediation text from Kyverno and gatekeeper-library metadata. |
| 💥 Enforcement impact | What moving a policy from audit to enforce would reject today, by namespace and owner. |
| 🚫 Recent denials | What was blocked or flagged at admission, from the engines' Events, with the requesting user where the engine records it. |
| 🧩 Engine views | Constraint templates with highlighted Rego and CEL, constraints, Kyverno policies and reports, VAPs and their bindings. |
| ⌨️ Scriptable | Every view prints as a table or JSON with p9s get; p9s report writes Markdown, HTML or JSON and can gate CI. |
| 📸 Offline | p9s snapshot records a cluster; --snapshot replays it through the same views anywhere. |
How to fix: the detail of a violation |
Impact: what enforcing a policy would block |
Recent denials: blocked requests and who made them |
VAPs: native policies, bindings and CEL |
| Engine | What p9s reads | Violations from |
|---|---|---|
| OPA Gatekeeper | ConstraintTemplates (Rego and CEL), constraints of every kind, the Config | constraint audit results |
| Kyverno | ClusterPolicies and Policies, and the CEL policies.kyverno.io family |
PolicyReports |
| ValidatingAdmissionPolicy | native policies and bindings (admissionregistration.k8s.io/v1, Kubernetes 1.30+) |
PolicyReports Kyverno writes for them, when enabled |
Engines are found through discovery and can run side by side; shared
views merge them with an ENGINE column. Policies that Gatekeeper or
Kyverno generate as VAPs are recognised and counted once, under their
source. CI runs the end-to-end suite on kind against the current
Gatekeeper and Kyverno Helm charts; the recordings here show Gatekeeper
v3.23 and Kyverno v1.19. Details per engine: docs/engines.md.
🍺 Homebrew (the formula lives in this repository):
brew tap yindia/p9s https://github.com/yindia/p9s
brew install p9s📜 Install script (macOS and Linux, amd64/arm64; verifies the release checksum):
curl -sSfL https://raw.githubusercontent.com/yindia/p9s/main/install.sh | sh -s -- -b /usr/local/bin
# a specific release: ... | sh -s -- -b /usr/local/bin vX.Y.Z🐹 Go:
go install github.com/yindia/p9s/cmd/p9s@latest📥 Binaries for macOS, Linux and Windows (amd64/arm64) are attached to
every release, with
checksums.txt. From a checkout: make build && ./bin/p9s.
p9s # current context, every engine it finds
p9s --context prod # another kubeconfig context
p9s -c v # open on violations, grouped by ownerYour first five minutes:
| Press | To |
|---|---|
:v |
list violations, grouped by owner; enter expands a group |
d |
describe the selected row: for a violation, the target, policy and how to fix |
i |
see what enforcing the selected policy would block |
] |
switch :v to recent admission denials ([ goes back) |
:health |
check webhooks, controllers, audits and policies |
/ |
filter: free text or engine:kyverno mode:audit ns:payments |
? |
every command and key; :q quits |
The same views without the TUI:
p9s get v -n payments -o json # any view, as a table or JSON
p9s report --format html -o report.html # a self-contained security report
p9s report --fail-on critical # exit 3 on critical findings, for CI
p9s snapshot -o prod.json # record now, browse later with --snapshotTip
No cluster handy? make e2e-up builds a kind cluster with Gatekeeper and
the gatekeeper-library, Kyverno with the restricted Pod Security policies,
demo workloads and native VAPs: what every recording here shows.
- 🔒 Read-only. p9s lists and watches with your kubeconfig identity and never creates, changes or deletes anything. Nothing runs in the cluster.
- ⚡ Informers, not polling. Caches drop
managedFieldsand kubectl's last-applied copy; owners come from metadata-only informers. - 🔐 RBAC-aware. A forbidden resource becomes a notice and everything else still renders; with namespace-only access p9s falls back to that namespace. See docs/rbac.md.
- 🎯 Honest numbers. A count the engine cannot provide is
-, never 0, and a capped Gatekeeper list says "showing N of M".
Engines plug in behind one interface, and the TUI, get and report all
render the same materialised views: docs/architecture.md.
| Guide | Covers |
|---|---|
| Using the TUI | every view, commands, keys, filtering, namespace scope, reading tables |
| Command line | get, snapshot, report, the config file and flags |
| Engines | detection, what each engine reports, engine views, generated VAPs |
| Access and RBAC | what p9s needs, namespace-only tenants, redaction |
| Architecture | layers, data flow and repository layout |
| Adding an engine | the engine interface, informers, contract tests |
| Development | the kind cluster, recordings and releases |
Issues and pull requests are welcome. Start with CONTRIBUTING.md for setup, the checks CI runs and commit conventions (signed off, DCO). AGENTS.md holds the rules the code follows, for people and coding agents alike.
- 🐛 Found a bug? Open an issue
(a
p9s snapshotof the cluster helps; Secret values are never recorded). - 💡 Want a view, an engine or a question answered? Request a feature.
Please report vulnerabilities privately through GitHub security advisories, not in a public issue. See SECURITY.md.
- k9s, whose keys and feel p9s follows.
- Bubble Tea, Lip Gloss and VHS from Charm.
- OPA Gatekeeper with the gatekeeper-library, and Kyverno with its policies, which the e2e cluster runs.
If p9s saves you a kubectl get constraints -o yaml, a ⭐ helps others find it.