Day 9: Cluster Hygiene
Goal: Scan a namespace with Popeye and read the report, find deprecated APIs in manifests with Pluto, compare utilization against requests with kube-capacity, and get recommendations for requests and limits from Goldilocks · Duration: approx. 80 min · Prerequisite: Day 8
Briefing
- A cluster that runs is not automatically healthy. Missing requests, Services without Pods, deprecated API versions in manifests: none of this stands out today, all of it will tomorrow.
- Popeye reads all resources of a namespace or
cluster and reports anomalies with a code (
POP-106), a severity level and an overall score. It changes nothing. - Pluto looks for
apiVersions that are deprecated or removed in a Kubernetes version: in files, in Helm releases and in the cluster. This is the mandatory check before every cluster upgrade. - kube-capacity (the Krew plugin
resource-capacityfrom Day 4) puts requests, limits and actual utilization side by side. For utilization, it needs the metrics-server. - Goldilocks creates a VerticalPodAutoscaler in recommendation mode for each Deployment and shows its suggestions in a dashboard. The VPA does not change anything about the Pods.
| Tool | Version | Status |
|---|---|---|
| Popeye | v0.22.1 | last release January 2025, last commit April 2025 |
| Pluto | v5.24.5 | active |
| metrics-server | chart 3.14.0 (app 0.9.0) | active |
| VPA (Fairwinds chart) | chart 5.2.0 (app 1.7.1) | active |
| Goldilocks | chart 11.3.1 (app v4.16.3) | active |
Popeye is dormant. The project is not archived, but has had no new release since early 2025. It runs against Kubernetes 1.37 (Drill 1), but shows gaps (Drill 2). Use it as a quick overview, not as the only check in the pipeline.
Drill 1: Installing and Running Popeye
ARCH=$(dpkg --print-architecture)
curl -sL https://github.com/derailed/popeye/releases/download/v0.22.1/popeye_linux_${ARCH}.tar.gz | tar xz -C /tmp popeye
sudo install /tmp/popeye /usr/local/bin/popeye
popeye versionExpected (after an ASCII-art logo, colors removed):
Version: 0.22.1
Commit: 35b554961dcdabfa7aba6bd070673c6c24c70884
Date: 2025-01-28T15:31:22Z
mkdir -p ~/werkzeuge/tag09 && cd ~/werkzeuge/tag09
popeye -n laden --force-exit-zeroThe report is long. Here are the important sections (shortened, colors and separator lines removed):
GENERAL [KIND-WERKZEUGE] (2026-11-24T13:26:22Z)
· Connectivity...................................................................................✅
· MetricServer...................................................................................💥
DEPLOYMENTS (4 SCANNED) 💥 0 😱 3 🔊 1 ✅ 0 25٪
· laden/api......................................................................................😱
🐳 whoami
😱 [POP-106] No resources requests/limits defined.
🔊 [POP-108] Unnamed port 8080.
· laden/cache....................................................................................😱
🐳 redis
😱 [POP-106] No resources requests/limits defined.
🔊 [POP-108] Unnamed port 6379.
· laden/kasse....................................................................................😱
🐳 kasse
😱 [POP-106] No resources requests/limits defined.
· laden/web......................................................................................🔊
🐳 nginx
🔊 [POP-108] Unnamed port 80.
PODS (10 SCANNED) 💥 0 😱 10 🔊 0 ✅ 0 0٪
· laden/api-7d5f77c79b-725kc.....................................................................😱
😱 [POP-1204] Pod egress is not secured by a network policy.
🔊 [POP-206] Pod has no associated PodDisruptionBudget.
😱 [POP-302] Pod could be running as root user. Check SecurityContext/Image.
🐳 whoami
😱 [POP-106] No resources requests/limits defined.
😱 [POP-102] No probes defined.
🔊 [POP-108] Unnamed port 8080.
😱 [POP-306] Container could be running as root user. Check SecurityContext/Image.
…
· laden/netshoot.................................................................................😱
😱 [POP-208] Unmanaged pod detected. Best to use a controller.
…
SECRETS (1 SCANNED) 💥 0 😱 0 🔊 1 ✅ 0 100٪
· laden/db-zugang................................................................................🔊
🔊 [POP-401] Key "DB_USER" used? Unable to locate key reference.
SUMMARY
Your cluster score: A (91)
This is how you read it:
- 💥 error, 😱 warning, 🔊 info, ✅ OK. The percentage per section is the share without errors and warnings.
MetricServer 💥: there is no metrics-server. You install it in Drill 4.POP-106for api, cache, kasse: no requests and limits. This is the weakness that has been in the shop since Day 0.webhas requests and is therefore missing here.POP-1204 Pod egress is not secured: forapi, Popeye only reports egress. Ingress is covered by the policy from Day 8, so Popeye does see it.POP-401: the Secretdb-zuganghas a keyDB_USERthat no Pod uses. A hint at leftovers that can be cleaned up.- The score A (91) sounds good, although every Pod has a warning. The score is weighted; only compare it with itself over time, not as an absolute verdict.
--force-exit-zero makes Popeye exit with 0. Without the
switch, it exits with an error code as soon as it finds 💥. That is
intended for a pipeline, but gets in the way when trying things out.
Save your progress? Sign up for free
Drill 2: Finding a Broken Service
On Day 8, netshoot showed that there is no Service
cache. A colleague creates it, with a typo in the
selector:
cat > cache-svc.yaml <<'EOF'
apiVersion: v1
kind: Service
metadata:
name: cache
namespace: laden
spec:
selector: {app: redis}
ports:
- port: 6379
EOF
kubectl apply -f cache-svc.yaml
popeye -n laden -s svc --force-exit-zeroExpected (shortened):
service/cache created
SERVICES (3 SCANNED) 💥 1 😱 0 🔊 2 ✅ 0 66٪
· laden/api......................................................................................🔊
🔊 [POP-1102] Use of target port #8080 for service port TCP::8080. Prefer named port.
· laden/cache....................................................................................💥
💥 [POP-1100] No pods match service selector.
-s svc restricts the run to Services,
-l error shows only errors. The Service exists and the name
resolves, but there is nobody behind it: exactly failure pattern 4 from
the exercise of Day 8. The Pods are labeled app=cache, not
app=redis.
kubectl -n laden patch svc cache -p '{"spec":{"selector":{"app":"cache"}}}'
kubectl -n laden get endpointslices -l kubernetes.io/service-name=cache -o jsonpath='{.items[0].endpoints[*].addresses}{"\n"}'
kubectl -n laden exec netshoot -- sh -c "printf 'PING\r\n' | nc -w2 cache 6379"Expected:
service/cache patched
["10.244.2.193"]
+PONG
Now cache resolves and Redis answers. Another run shows
only
POP-1109 Single endpoint is associated with this service
for cache: one replica, no protection against failure.
You see a gap in Popeye when you compare the section headers. With
-n laden, Popeye reports 0 SCANNED for each of
NETWORKPOLICIES, ROLEBINDINGS and
SERVICEACCOUNTS, although there is a policy, a RoleBinding
and several ServiceAccounts in laden. Only cluster-wide
does it count them:
popeye -A --force-exit-zero | grep -E "NETWORKPOLICIES|ROLEBINDINGS|SERVICEACCOUNTS"Expected (colors removed, numbers will differ):
CLUSTERROLEBINDINGS (77 SCANNED) 💥 0 😱 4 🔊 0 ✅ 73 94٪
NETWORKPOLICIES (1 SCANNED) 💥 0 😱 0 🔊 0 ✅ 1 100٪
ROLEBINDINGS (18 SCANNED) 💥 0 😱 0 🔊 0 ✅ 18 100٪
SERVICEACCOUNTS (67 SCANNED) 💥 0 😱 1 🔊 0 ✅ 66 98٪
Remember: a tool that reports “0 SCANNED, 100 %” has not checked, not passed.
Save your progress? Sign up for free
Drill 3: Custom Rules with spinach
Not every hint fits every team. netshoot and
werkbank are bare Pods on purpose, and named ports are not
a rule in the shop. A spinach file switches off codes,
globally or for specific objects:
cat > spinach.yaml <<'EOF'
popeye:
excludes:
global:
codes: ["108", "1102", "105"]
linters:
pods:
instances:
- fqns: [rx:^laden/(netshoot|werkbank)]
codes: ["208", "1204", "206", "300", "302", "306", "106", "102"]
EOF
popeye -n laden -f spinach.yaml -s po --force-exit-zero | grep -E "PODS|netshoot|werkbank|POP-108"Expected (colors removed):
PODS (8 SCANNED) 💥 0 😱 8 🔊 0 ✅ 0 0٪
Eight instead of ten Pods: the two tool Pods drop out, and no more
POP-108. The file belongs in the team’s repo so that
everyone applies the same standard. -o json,
-o junit and -o html deliver the report for
pipelines and archiving, -o score just the number.
Save your progress? Sign up for free
Drill 4: Utilization Against Requests
Without a metrics-server, there is no utilization:
kubectl top fails with
Metrics API not available. In kind, the metrics-server
needs --kubelet-insecure-tls because the kubelets’
certificates are not signed by the cluster CA. This applies to the lab
only.
helm repo add metrics-server https://kubernetes-sigs.github.io/metrics-server/
helm repo update metrics-server
helm install metrics-server metrics-server/metrics-server -n kube-system --version 3.14.0 --set "args={--kubelet-insecure-tls}"
kubectl -n kube-system rollout status deploy/metrics-server --timeout=120sAfter about 30 seconds:
kubectl top nodesExpected (values will differ):
NAME CPU(cores) CPU(%) MEMORY(bytes) MEMORY(%)
werkzeuge-control-plane 540m 13% 1024Mi 12%
werkzeuge-worker 360m 9% 793Mi 9%
werkzeuge-worker2 320m 8% 884Mi 11%
kubectl top shows only utilization. kube-capacity puts
it next to requests and limits:
kubectl resource-capacity --util --sort cpu.utilExpected (values will differ):
NODE CPU REQUESTS CPU LIMITS CPU UTIL MEMORY REQUESTS MEMORY LIMITS MEMORY UTIL
* 1400m (11%) 3000m (25%) 1144m (9%) 566Mi (2%) 3604Mi (15%) 2707Mi (11%)
werkzeuge-control-plane 750m (18%) 1000m (25%) 509m (12%) 110Mi (1%) 1024Mi (12%) 1027Mi (12%)
werkzeuge-worker2 200m (5%) 1000m (25%) 321m (8%) 74Mi (0%) 1152Mi (14%) 890Mi (11%)
werkzeuge-worker 450m (11%) 1000m (25%) 315m (7%) 382Mi (4%) 1428Mi (17%) 791Mi (9%)
Do you notice werkzeuge-worker2? 200m requested,
321m used. The scheduler plans by requests, not by usage. On
this node, Pods are running that take more than they declared, and the
scheduler would still place much more there. Now per Pod in
laden:
kubectl resource-capacity -n laden --pods --utilExpected (excerpt):
NODE POD CPU REQUESTS CPU LIMITS CPU UTIL MEMORY REQUESTS MEMORY LIMITS MEMORY UTIL
werkzeuge-worker2 * 100m (2%) 0m (0%) 22m (0%) 64Mi (0%) 128Mi (1%) 27Mi (0%)
werkzeuge-worker2 api-7d5f77c79b-725kc 0m (0%) 0m (0%) 0m (0%) 0Mi (0%) 0Mi (0%) 2Mi (0%)
werkzeuge-worker2 cache-55b4555575-xkp72 0m (0%) 0m (0%) 16m (0%) 0Mi (0%) 0Mi (0%) 5Mi (0%)
werkzeuge-worker2 kasse-74bbfbb76-vrn9x 0m (0%) 0m (0%) 6m (0%) 0Mi (0%) 0Mi (0%) 1Mi (0%)
werkzeuge-worker2 netshoot 0m (0%) 0m (0%) 0m (0%) 0Mi (0%) 0Mi (0%) 10Mi (0%)
werkzeuge-worker2 web-67649cfddb-6d48k 50m (1%) 0m (0%) 1m (0%) 32Mi (0%) 64Mi (0%) 5Mi (0%)
Two patterns at once: cache uses CPU without a request
(invisible to the scheduler), web requested 50m and needs
1m (reserved, unused capacity). Which number would be right? Goldilocks
answers that.
Save your progress? Sign up for free
Drill 5: Goldilocks
Goldilocks needs the VPA recommender. You switch off the updater and the admission controller: they would restart Pods and change requests. Here, it should only recommend.
helm repo add fairwinds-stable https://charts.fairwinds.com/stable
helm repo update fairwinds-stable
helm install vpa fairwinds-stable/vpa -n vpa --create-namespace --version 5.2.0 \
--set updater.enabled=false --set admissionController.enabled=false
helm install goldilocks fairwinds-stable/goldilocks -n goldilocks --create-namespace --version 11.3.1
kubectl -n goldilocks rollout status deploy/goldilocks-dashboard --timeout=120s
kubectl label ns laden goldilocks.fairwinds.com/enabled=trueGoldilocks only watches namespaces with this label. After one minute:
kubectl -n laden get vpa
kubectl -n laden get vpa goldilocks-web -o jsonpath='{.status.recommendation.containerRecommendations}{"\n"}'Expected:
NAME MODE CPU MEM PROVIDED AGE
goldilocks-api Off 15m 100Mi True 51s
goldilocks-cache Off 23m 100Mi True 51s
goldilocks-kasse Off 15m 100Mi True 51s
goldilocks-web Off 15m 100Mi True 51s
[{"containerName":"nginx","lowerBound":{"cpu":"15m","memory":"100Mi"},"target":{"cpu":"15m","memory":"100Mi"},"uncappedTarget":{"cpu":"15m","memory":"100Mi"},"upperBound":{"cpu":"73118m","memory":"76442269230"}}]
MODE Off means: recommend only. Read the numbers with
caution:
- 15m and 100Mi are the recommender’s lower bounds,
not a measurement. Almost all Deployments land exactly there after one
minute; only
cacheis already above it with 23m. upperBound73118m (73 cores) means “no idea yet”. The upper bound only shrinks with days of data. Recommendations are usable after a week of normal load, not after a minute.
The dashboard turns this into suggestions for two classes. Port forward:
kubectl -n goldilocks port-forward --address 0.0.0.0 svc/goldilocks-dashboard 8090:80Open http://<VM-IP>:8090/dashboard/laden and
expand the containers for web:
On the left for Guaranteed (request = limit), on the
right for Burstable (request from target,
limit from upperBound). On the right, you see the 73118m
again: whoever adopts that as a limit without looking effectively has
none. Under YAML for Recommended Settings is the block
to paste into the manifest.
Do not fill in: At the top of the dashboard, a form asks for an e-mail address for the vendor’s cost estimates. Goldilocks itself does not need it.
Save your progress? Sign up for free
Drill 6: Pluto Before the Upgrade
curl -sL https://github.com/FairwindsOps/pluto/releases/download/v5.24.5/pluto_5.24.5_linux_${ARCH}.tar.gz | tar xz -C /tmp pluto
sudo install /tmp/pluto /usr/local/bin/pluto
pluto versionExpected:
Version:5.24.5 Commit:d7d4f3f312f5b65c989a5a4eb92eb6b4ef86e29f
The shop’s repo still contains old manifests from an earlier time:
mkdir -p alt
cat > alt/pdb.yaml <<'EOF'
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
name: web
namespace: laden
spec:
minAvailable: 2
selector:
matchLabels: {app: web}
EOF
cat > alt/hpa.yaml <<'EOF'
apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
name: web
namespace: laden
spec:
scaleTargetRef: {apiVersion: apps/v1, kind: Deployment, name: web}
minReplicas: 3
maxReplicas: 6
metrics:
- type: Resource
resource: {name: cpu, target: {type: Utilization, averageUtilization: 70}}
EOF
cat > alt/ingress.yaml <<'EOF'
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: web
namespace: laden
spec:
rules:
- host: laden.example
http:
paths:
- path: /
pathType: Prefix
backend:
service: {name: web, port: {number: 80}}
EOF
pluto detect-files -d alt -o wideExpected:
NAME NAMESPACE KIND VERSION REPLACEMENT DEPRECATED DEPRECATED IN REMOVED REMOVED IN REPL AVAIL REPL AVAIL IN
web laden HorizontalPodAutoscaler autoscaling/v2beta2 autoscaling/v2 true v1.23.0 false v1.26.0 false
web laden PodDisruptionBudget policy/v1beta1 policy/v1 true v1.21.0 true v1.25.0 true v1.21.0
The Ingress is clean. But watch out with the HPA:
REMOVED false, although autoscaling/v2beta2
has been gone since v1.26. Without a target version, Pluto compares with
a built-in target version that is older than your cluster.
Always specify the target version:
pluto detect-files -d alt -t k8s=v1.37.0
echo "exit $?"Expected:
NAME KIND VERSION REPLACEMENT REMOVED DEPRECATED REPL AVAIL
web HorizontalPodAutoscaler autoscaling/v2beta2 autoscaling/v2 true true false
web PodDisruptionBudget policy/v1beta1 policy/v1 true true true
exit 4
kubectl shows what this means for the cluster:
kubectl apply -f alt/pdb.yamlExpected:
error: resource mapping not found for name: "web" namespace: "laden" from "alt/pdb.yaml": no matches for kind "PodDisruptionBudget" in version "policy/v1beta1"
ensure CRDs are installed first
The hint about CRDs is misleading: the API version simply no longer exists.
The exit codes are meant for pipelines: 2 =
deprecated, 3 = removed, 4 =
deprecated and REPL AVAIL false. Each level can be switched
off individually:
pluto detect-files -d alt -t k8s=v1.37.0 --ignore-unavailable-replacements >/dev/null; echo "exit $?"
pluto detect-files -d alt -t k8s=v1.37.0 --ignore-unavailable-replacements --ignore-removals >/dev/null; echo "exit $?"Expected:
exit 3
exit 2
The fix is simple here because the fields have not changed:
sed -i 's#policy/v1beta1#policy/v1#' alt/pdb.yaml
sed -i 's#autoscaling/v2beta2#autoscaling/v2#' alt/hpa.yaml
pluto detect-files -d alt -t k8s=v1.37.0; echo "exit $?"
kubectl apply --dry-run=server -f alt/Expected:
There were no resources found with known deprecated apiVersions.
exit 0
horizontalpodautoscaler.autoscaling/web created (server dry run)
ingress.networking.k8s.io/web created (server dry run)
poddisruptionbudget.policy/web created (server dry run)
With other migrations (such as extensions/v1beta1
Ingress to networking.k8s.io/v1), the structure changes
too; then sed is not enough. In the cluster and in Helm
releases, Pluto finds nothing here:
pluto detect-helm -o wide
pluto detect-api-resources -o wideExpected:
There were no resources found with known deprecated apiVersions.
There were no resources found with known deprecated apiVersions.
detect-helm reads the manifests from the stored Helm
releases. This matters because a Helm release with a removed API version
can neither be upgraded nor deleted after the cluster upgrade.
Save your progress? Sign up for free
Exercise: Finding and Tool
Which tool from this day answers the question?
- Can I upgrade to 1.38 without a chart breaking?
- Why is node X full, although the Pods hardly need any CPU?
- Are there Services with nobody behind them?
- Which requests should I set for
kasse?
Solution
pluto detect-helm -t k8s=v1.38.0andpluto detect-fileson the repo.kubectl resource-capacity --util: requests high, utilization low.popeye -A -s svc -l error:POP-1100.- Goldilocks or
kubectl -n laden get vpa goldilocks-kasse, after a few days of load.
Save your progress? Sign up for free
Challenge
Give the checkout (kasse) requests and limits based on
the VPA’s recommendation (Burstable: request = target,
limit generous but finite). Then prove that Popeye no longer reports
POP-106 for kasse.
Solution
kubectl -n laden get vpa goldilocks-kasse -o jsonpath='{.status.recommendation.containerRecommendations[0].target}{"\n"}'
kubectl -n laden set resources deploy kasse -c kasse --requests=cpu=15m,memory=100Mi --limits=cpu=100m,memory=128Mi
kubectl -n laden rollout status deploy/kasse --timeout=90s
popeye -n laden -s deploy --force-exit-zero | grep -A3 "laden/kasse"Expected (colors removed):
{"cpu":"15m","memory":"100Mi"}
deployment.apps/kasse resource requirements updated
deployment "kasse" successfully rolled out
· laden/kasse....................................................................................✅
The limit of 100m CPU is a decision, not a measured value: about seven times what the checkout used in Drill 4. A CPU limit only throttles; a memory limit that is too tight terminates the container (OOMKilled). That is why you leave more headroom for memory than for CPU.
Save your progress? Sign up for free
Checkpoint
popeye version | grep -a Version
pluto version
kubectl -n laden get svc cache -o jsonpath='{.spec.selector.app}{"\n"}'
kubectl -n laden get vpa --no-headers | wc -l
kubectl -n laden get deploy kasse -o jsonpath='{.spec.template.spec.containers[0].resources.requests.cpu}{"\n"}'Expected:
Version: 0.22.1
Version:5.24.5 Commit:d7d4f3f312f5b65c989a5a4eb92eb6b4ef86e29f
cache
4
15m
Interview Note
- What do you check before a cluster upgrade?
Deprecated and removed APIs in manifests, Helm releases and in the
cluster (Pluto, or
kubectl get --raw /metrics | grep apiserver_requested_deprecated_apis), plus the release notes. - Requests or utilization, which does the scheduler plan by? By requests. Pods without requests are free for it and make nodes fuller than they look.
- How do you arrive at sensible requests? Measure over days (VPA in mode Off, Goldilocks), then adopt and observe. Do not guess, and do not take the values from the first day.
Enterprise Note
- Popeye fits a quick look and teams that check their own namespace. For binding rules in the pipeline, use actively maintained tools with policies as code (Day 10: kube-linter, Polaris; Kyverno or Gatekeeper in the cluster).
- Pluto belongs in the CI of every repo with manifests or charts, with
-t k8s=<next version>, so that breakages show up before the upgrade, not after. - Running the VPA in mode
Autochanges requests by restarting Pods. Many teams leave it atOffand adopt recommendations deliberately via Git; that way, the manifest stays the source of truth.