Skip to content

Commit 6398de4

Browse files
committed
Add details for On Success notes
Signed-off-by: Laura Lorenz <[email protected]>
1 parent 385894f commit 6398de4

File tree

1 file changed

+69
-3
lines changed
  • keps/sig-node/4603-tune-crashloopbackoff

1 file changed

+69
-3
lines changed

keps/sig-node/4603-tune-crashloopbackoff/README.md

Lines changed: 69 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ approach to revisiting the CrashLoopBackoff behaviors for common use cases:
218218
2. allowing Pods to opt-in to an even faster backoff curve
219219

220220
For each of these changes, the exact values are subject to modification in the
221-
alpha period in order to empirically derive derived defaults intended to
221+
alpha period in order to empirically derive defaults intended to
222222
maintain node stability.
223223

224224
## Motivation
@@ -436,9 +436,75 @@ This might be a good place to talk about core concepts and how they relate.
436436
-->
437437
#### On Success
438438

439-
The original version of this proposal included a change specific to Pods transitioning through the "Succeeded" phase. On further discussion, this was determined to be both too risky and a non-goal for Kubernetes architecturally, and moved into the Alternatives section. The risk for bad actors is described in the Alternatives section and is somewhat obvious. The larger point of it being a non-goal within the design framework of Kubernetes as a whole is less transparent and discussed here.
439+
The original version of this proposal included a change specific to Pods
440+
transitioning through the "Succeeded" phase to have flat rate restarts. On
441+
further discussion, this was determined to be both too risky and a non-goal for
442+
Kubernetes architecturally, and moved into the Alternatives section. The risk
443+
for bad actors overloading the kubelet is described in the Alternatives section
444+
and is somewhat obvious. The larger point of it being a non-goal within the
445+
design framework of Kubernetes as a whole is less transparent and discussed
446+
here.
447+
448+
After discussion with early Kubernetes contributors and members of SIG-Node,
449+
it's become more clear to the author that the prevailing Kubernetes assumption
450+
is that that on its own, the Pod API best models long-running containers that
451+
rarely or never exit themselves with "Success"; features like autoscaling,
452+
rolling updates, and enhanced workload types like StatefulSets assume this,
453+
while other workload types like those implemented with the Job and CronJob API
454+
better model workloads that do exit themselves, running until Success or at
455+
predictable intervals. In line with this assumption, Pods that run "for a while"
456+
(longer than 10 minutes) are the ones that are "rewarded" with a reset backoff
457+
counter -- not Pods that exit with Success. Ultimately, non-Job Pods are not
458+
intended to exit Successfully in any meaningful way to the infrastructure, and
459+
quick rerun behavior of any application code is considered to be an application
460+
level concern instead.
461+
462+
Therefore, even though it is widely desired by commenters on
463+
[Kubernetes#57291](https://github.com/kubernetes/kubernetes/issues/57291), this
464+
KEP is not pursuing a different backoff curve for Pods exiting with Success any
465+
longer.
466+
467+
For Pods that are today intended to rerun after Success, it is instead suggested
468+
to
469+
470+
1. exec the application logic with an init script or shell that reruns it
471+
indefinitely, like that described in
472+
[Kubernetes#57291#issuecomment-377505620](https://github.com/kubernetes/kubernetes/issues/57291#issuecomment-377505620):
473+
```
474+
#!/bin/bash
475+
476+
while true; do
477+
python /code/app.py
478+
done
479+
```
480+
2. or, if a shell in particular is not desired, implement the application such
481+
that it starts and monitors the restarting process inline, or as a
482+
subprocess/separate thread/routine
483+
484+
The author is aware that these solutions still do not address use cases where
485+
users have taken advantage of the "cleaner" state "guarantees" of a restarted
486+
pod to alleviate security or privacy concerns between sequenced Pod runs. In
487+
these cases, during alpha, it is recommended to take advantage of the
488+
`restartPolicy: Rapid` option, with expectations that on further infrastructure
489+
analysis this behavior may become even faster.
490+
491+
This decision here does not disallow the possibility that this is solved in
492+
other ways, for example:
493+
1. the Job API, which better models applications with meaningful Success states,
494+
introducing a variant that models fast-restarting apps by infrastructure
495+
configuration instead of by their code, i.e. Jobs with `restartPolicy:
496+
Always` and/or with no completion count target
497+
2. support restart on exit 0 as a directive in the container runtime or as a
498+
common independent tool, e.g. `RESTARTABLE CMD mycommand` or
499+
`restart-on-exit-0 -- mycommand -arg -arg -arg`
500+
3. formalized reaper behavior such as discussed in
501+
[Kubernetes#50375](https://github.com/kubernetes/kubernetes/issues/50375)
502+
503+
However, there will always need to be some throttling or quota for restarts to
504+
protect node stability, so even if these alternatives are pursued separately,
505+
they will depend on the analysis and benchmarking implementation during this
506+
KEP's alpha stage to stay within node stability boundaries.
440507

441-
FIXME: explain some more
442508

443509
### Risks and Mitigations
444510

0 commit comments

Comments
 (0)