A Kubernetes cluster resource sanitizer
Popeye is a utility that scans live Kubernetes clusters and reports potential issues with deployed resources and configurations. As Kubernetes landscapes grows, it is becoming a challenge for a human to track the slew of manifests and policies that orchestrate a cluster. Popeye scans your cluster based on what's deployed and not what's sitting on disk. By linting your cluster, it detects misconfigurations, stale resources and assists you to ensure that best practices are in place, thus preventing future headaches. It aims at reducing the cognitive overload one faces when operating a Kubernetes cluster in the wild. Furthermore, if your cluster employs a metric-server, it reports potential resources over/under allocations and attempts to warn you should your cluster run out of capacity.
Popeye is a readonly tool, it does not alter any of your Kubernetes resources in any way!
You can dump the scan report to HTML.
Popeye publishes Prometheus metrics. We provided a sample Popeye dashboard to get you started in this repo.
Popeye is available on Linux, OSX and Windows platforms.
Binaries for Linux, Windows and Mac are available as tarballs in the release page.
For OSX/Unit using Homebrew/LinuxBrew
brew install derailed/popeye/popeyeUsing go install
go install github.com/derailed/popeye@latestBuilding from source Popeye was built using go 1.21+. In order to build Popeye from source you must:
Clone the repo
Add the following command in your go.mod file
replace (
github.com/derailed/popeye => MY_POPEYE_CLONED_GIT_REPO
)Build and run the executable
go run main.goQuick recipe for the impatient:
# Clone outside of GOPATH
git clone https://github.com/derailed/popeye
cd popeye
# Build and install
make build
# Run
popeyePopeye uses 256 colors terminal mode. On `Nix system make sure TERM is set accordingly.
export TERM=xterm-256colorYou can use Popeye wide open or using a spinach yaml config to tune your linters. Details about the Popeye configuration file are below.
…Popeye scans your cluster for best practices and potential issues. Currently, Popeye only looks for a given set of curated Kubernetes resources. More will come soon! We are hoping Kubernetes friends will pitch'in to make Popeye even better.
The aim of the linters is to pick up on misconfigurations, i.e. things like port mismatches, dead or unused resources, metrics utilization, probes, container images, RBAC rules, naked resources, etc...
Popeye is not another static analysis tool. It runs and inspect Kubernetes resources on live clusters and lint resources as they are in the wild!
Here is a list of some of the available linters:
| Resource | Linters | Aliases | |
|---|---|---|---|
| Node | no | ||
| Conditions ie not ready, out of mem/disk, network, pids, etc | |||
| Pod tolerations referencing node taints | |||
| CPU/MEM utilization metrics, trips if over limits (default 80% CPU/MEM) | |||
| Namespace | ns | ||
| Inactive | |||
| Dead namespaces | |||
| Pod | po | ||
| Pod status | |||
| Containers statuses | |||
| ServiceAccount presence | |||
| CPU/MEM on containers over a set CPU/MEM limit (default 80% CPU/MEM) | |||
| Container image with no tags | |||
Container image using latest tag |
|||
| Resources request/limits presence | |||
| Probes liveness/readiness presence | |||
| Named ports and their references | |||
| Service | svc | ||
| Endpoints presence | |||
| Matching pods labels | |||
| Named ports and their references | |||
| ServiceAccount | sa | ||
| Unused, detects potentially unused SAs | |||
| Secrets | sec | ||
| Unused, detects potentially unused secrets or associated keys | |||
| ConfigMap | cm | ||
| Unused, detects potentially unused cm or associated keys | |||
| Deployment | dp, deploy | ||
| Unused, pod template validation, resource utilization | |||
| StatefulSet | sts | ||
| Unused, pod template validation, resource utilization | |||
| DaemonSet | ds | ||
| Unused, pod template validation, resource utilization | |||
| PersistentVolume | pv | ||
| Unused, check volume bound or volume error | |||
| PersistentVolumeClaim | pvc | ||
| Unused, check bounded or volume mount error | |||
| HorizontalPodAutoscaler | hpa | ||
| Unused, Utilization, Max burst checks | |||
| PodDisruptionBudget | |||
| Unused, Check minAvailable configuration | pdb | ||
| ClusterRole | |||
| Unused | cr | ||
| ClusterRoleBinding | |||
| Unused | crb | ||
| Role | |||
| Unused | ro | ||
| RoleBinding | |||
| Unused | rb | ||
| Ingress | |||
| Valid | ing | ||
| NetworkPolicy | |||
| Valid, Stale, Guarded | np | ||
| PodSecurityPolicy | |||
| Valid | psp | ||
| Cronjob | |||
| Valid, Suspended, Runs | cj | ||
| Job | |||
| Pod checks | job | ||
| GatewayClass | |||
| Valid, Unused | gwc | ||
| Gateway | |||
| Valid, Unused | gw | ||
| HTTPRoute | |||
| Valid, Unused | gwr |
You can also see the full list of codes
To save the Popeye report to a file pass the --save flag to the command.
By default it will create a tmp directory and will store your scan report there.
The path of the tmp directory will be printed out on STDOUT.
If you have the need to specify the output directory for the report,
you can use this environment variable POPEYE_REPORT_DIR. The final path will be <POPEYE_REPORT_DIR>//.
By default, the name of the output file follow the following format : lint_<cluster-name>_<time-UnixNano>.<output-extension> (e.g. : "lint-mycluster-1594019782530851873.html").
If you want to also specify the output file name for the report, you can pass the `--output-
[Feature] Generic CRD/operator-aware reference resolution for Secrets/ConfigMaps (POP-400 false positives)
"--min-score" flag returns non-zero exit even when threshold is met
Detect candidates for `hostUsers: false`
[POP-105] `probe` must use port number for GRPC
[Feature] annotations to ignore specific codes
POP-1208: False positive for cross-namespace NetworkPolicy pod selectors
POP-1206: False positive for NetworkPolicy IPBlock egress rules
[Feature]: note `networkPolicy` objects that use port numbers rather than names.
Add Kubernetes Version into yaml output
POP-1700: possible false positive (no cilium endpoints matched selector)