Cluster autoscaler probably cannot drain nodes running Tapas pods

Open
#52 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
46/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
go, kubernetes

Research direction

Start with internal/executor/kube/layout.go:22-27 and trace pod creation in internal/executor/kube/render.go:23, plus the emptyDir definitions in internal/pixienv/pixienv.go:266, internal/podfiles/podfiles.go:72, and internal/controller/jobs/build.go:245. Compare the generated pod volumes and annotations with the cluster autoscaler's FAQ, then verify the behavior on an autoscaled node with an app pod and a job pod. Done means the observed eviction behavior is documented and the annotation behavior or intended policy is resolved.

Written by the indexing model from the issue text.

Description

needs: investigation 🔍 type: bug 🐛

Tapas marks app, run and file pods with cluster-autoscaler.kubernetes.io/safe-to-evict-local-volumes: scratch,tmp (internal/executor/kube/layout.go:22-27), so the cluster autoscaler can drain a node whose only local data is scratch space. Reading the code against the autoscaler's FAQ, I don't think the annotation can have that effect for any of our pods.

App and file pods are bare pods. Render creates a corev1.Pod with no owner (internal/executor/kube/render.go:23). The FAQ ("What types of pods can prevent CA from removing a node?") lists "Pods that are not backed by a controller object" as blocking scale-down, unless the pod has cluster-autoscaler.kubernetes.io/safe-to-evict: "true". The local-volumes annotation doesn't lift that.

Job pods have unlisted emptyDirs. Job pods do have a controller, so the local-storage rule applies to them. The FAQ says the annotation only helps when "all of the pod's local volumes are listed in the annotation value", and it counts every emptyDir that isn't medium: Memory. Our pods carry several besides scratch and tmp, for example:

  • javo-env (internal/pixienv/pixienv.go:266);
  • the pod-files volumes (internal/podfiles/podfiles.go:72);
  • the runner volume for jobs (internal/controller/jobs/build.go:245).

What I haven't checked: I haven't drained a node with the autoscaler, and the FAQ doesn't spell out what happens when one local volume is missing from the list. To check, run an app and a job on a node of an autoscaled group (autoscaler defaults, which per the FAQ's parameter table include --skip-nodes-with-local-storage=true), leave the node otherwise idle, and see whether the autoscaler removes it or logs the pod as blocking.

If it holds, we need to decide what we want:

  • App pods: is it safe to evict a running app? Evicting stops the person's session; the home survives. If yes, set safe-to-evict: "true". If no, the current behaviour is right and the local-volumes annotation is dead code.
  • Job pods: list every emptyDir in the annotation, built from the pod's volumes instead of a fixed string.

Found while writing the pixi mirror spec (#25), which adds one more emptyDir (envs) to the list.

Dominant language
Go
Stars
5
Forks
0
Avg merge
21h 13m
Merged PRs (30d)
53

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from nebari-dev/tapas

All issues in nebari-dev/tapas

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.