Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KEP-3017: Promote unhealthyPodEvictionPolicy for PDBs to Beta #3777

Merged
merged 1 commit into from
Feb 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion keps/prod-readiness/sig-apps/3017.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
kep-number: 3017
alpha:
approver: "@wojtek-t"
approver: "@wojtek-t"
beta:
approver: "@wojtek-t"
111 changes: 49 additions & 62 deletions keps/sig-apps/3017-pod-healthy-policy-for-pdb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ https://storage.googleapis.com/k8s-triage/index.html
- <test>: <link to test coverage>
-->

[TestEvictionWithUnhealthyPodEvictionPolicy](https://github.com/kubernetes/kubernetes/blob/c8010537913422cc221cdd784936ff99817f621c/test/integration/evictions/evictions_test.go#L417): https://storage.googleapis.com/k8s-triage/index.html?test=UnhealthyPodEvictionPolicy
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few more comments (on top of what @logicalhan already pointed below too):

L364: "No, but they will be added for alpha"

Alpha has happened - can you update with the test that were added?

L370: "It does not change the default behavior. Users will have to specify a policy
on the PDB for behavior to be affected."

That's not really answer to the question. The question is not what changes, but how can a rollout fail? (e.g. apiserver can start crashing, etc.)

L375: Please specify the exact metric that reports that

L378: was this test run? If so, please update. If not, please ensure this will happen prior promoting feature gate to beta.

L400: the whole monitoring section is not filled-in

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was this test run? If so, please update. If not, please ensure this will happen prior promoting feature gate to beta.

I will try to run this test soon

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

following up here #3777 (review)


##### e2e tests

Expand Down Expand Up @@ -306,13 +307,15 @@ We expect no non-infra related flakes in the last month as a GA graduation crite

- Feature gate enabled by default.
- Existing E2E and conformance tests passing.
- Consider whether we want to keep the `spec.unhealthyPodEvictionPolicy` field null by default when not specified
or default it to `IfHealthyBudget` value. Both of these should preserve original behavior and handle null
values. This should be tested and documented.
- We want to keep the `spec.unhealthyPodEvictionPolicy` field null by default when not specified.
This should preserve the original behavior and behave the same as the `IfHealthyBudget` value.
This should be tested and documented.
- manual test for upgrade->downgrade->upgrade path will be performed once 1.27 is released

#### GA

- Every bug report is fixed.
- Introduce E2E tests for this field and confirm their stability.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it enough to have the E2E tests before GA or should it be sooner?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, having a test run at beta, when we enable the feature gate as the default is usually sufficient.

- The eviction API ignores the feature gate.

#### Deprecation
Expand Down Expand Up @@ -359,22 +362,27 @@ The eviction API will again start using the `unhealthyPodEvictionPolicy` if prov

###### Are there any tests for feature enablement/disablement?

No, but they will be added for alpha.
- [TestPodDisruptionBudgetStrategy](https://github.com/kubernetes/kubernetes/blob/06914bdaf51fc1b91501c332bd69d439cd370581/pkg/registry/policy/poddisruptionbudget/strategy_test.go#L96-L114)

### Rollout, Upgrade and Rollback Planning

###### How can a rollout or rollback fail? Can it impact already running workloads?

It does not change the default behavior. Users will have to specify a policy
on the PDB for behavior to be affected.
Bugs could affect `/evictions` endpoint which would return server error in that case.
It cannot directly affect workloads, but could potentially cause node drain to stall,
which would have an effect on the cluster during an upgrade.

When the rollback occurs, existing filled `.spec.unhealthyPodEvictionPolicy` fields will be ignored
and the old eviction behavior will be enforced for these PDBs.

###### What specific metrics should inform a rollback?

Unexpected failing eviction requests.
Failing eviction requests could be an indicator. `apiserver_request_total{resource = "pods", subresource = "eviction"}` metric
can be observed to detect increased rate of failing evictions.

###### Were upgrade and rollback tested? Was the upgrade->downgrade->upgrade path tested?

A manual test will be performed, as follows:
A manual test was performed, as follows:

1. Create a cluster in 1.25.
2. Upgrade to 1.26.
Expand All @@ -383,82 +391,60 @@ A manual test will be performed, as follows:
5. Verify that the eviction continue to work without using the UnhealthyPodEvictionPolicy.
6. Create another StatefulSet B and PDB B targeting the pods of StatefulSet B.
7. Upgrade to 1.26.
8. Verify that eviction of pods for Deployment A uses the `UnhealthyPodEvictionPolicy` UnhealthyPodEvictionPolicy and eviction of pods for
StatefulSet B uses the default behavior.
8. Verify that eviction of pods for Deployment A and StatefulSet B use the default behavior.
Verify that the `AlwaysAllow` UnhealthyPodEvictionPolicy can be set again to a PDB of Deployment A and test the eviction behavior
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have done the manual upgrade->downgrade->upgrade test, but the outcome is not the one as originally described by @mortent.

That is, when we downgrade to 1.25 the unhealthyPodEvictionPolicy field is preserved in etcd, until an update happens to the PDB. Eg by dirsuption controller when updating status, which is triggered for example by eviction that we do in step 5. The field is then removed from etcd and will not be present when we upgrade to 1.26.

Only hacky way to preserve it is to ensure there is no update to the PDB.

I am not sure if this is expected behaviour for new fields. I have found something relevant mentioned here https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api_changes.md

It must be possible to rollback to a previous version of API server that does not include your change and have no impact on API objects which do not use your change. API objects that use your change will be impacted in case of a rollback.

so it seems we should expect impact on API objects in case of a rollback, so the current behaviour would be correct?

I have updated the KEP to reflect that, but I am not sure if I am not missing something. Can @liggitt or anybody else confirm that?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK - this was rollback to the version that doesn't recognize this field, so if something was touching this object, the fact that this field is dropped isn't unexpected.

I think it would be useful to make this test again but switching from 1.27 -> 1.26 -> 1.27, in which case you would be downgrading to a version that already supports that and see that (an alternative is to just disable FG within 1.26 version).

If you could add a TODO for doing that, it would be great.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for confirming.

Good idea, I have added a TODO to test the 1.27 upgrade path


TODO:
A manual test will be performed, as follows:

1. Create a cluster in 1.26.
2. Upgrade to 1.27.
3. Create Deployment A and PDB A targeting the pods of Deployment A using the `AlwaysAllow` UnhealthyPodEvictionPolicy.
4. Downgrade to 1.26.
5. Verify that the eviction continue to work without using the UnhealthyPodEvictionPolicy (PDBUnhealthyPodEvictionPolicy feature gate disabled by default).
6. Create another StatefulSet B and PDB B targeting the pods of StatefulSet B.
7. Upgrade to 1.27.
8. Verify that eviction of pods for Deployment A uses the `AlwaysAllow` UnhealthyPodEvictionPolicy and eviction of pods for
StatefulSet B uses the default behavior.

###### Is the rollout accompanied by any deprecations and/or removals of features, APIs, fields of API types, flags, etc.?

N/A

### Monitoring Requirements

<!--
This section must be completed when targeting beta to a release.
-->

###### How can an operator determine if the feature is in use by workloads?

<!--
Ideally, this should be a metric. Operations against the Kubernetes API (e.g.,
checking if there are objects with field X set) may be a last resort. Avoid
logs or events for this purpose.
-->
By checking `.spec.unhealthyPodEvictionPolicy` field of the PodDisruptionBudget.
Pods belonging to this PDB should be evicted according to this policy.

###### How can someone using this feature know that it is working for their instance?

<!--
For instance, if this is a pod-related feature, it should be possible to determine if the feature is functioning properly
for each individual pod.
Pick one more of these and delete the rest.
Please describe all items visible to end users below with sufficient detail so that they can verify correct enablement
and operation of this feature.
Recall that end users cannot usually observe component logs or access metrics.
-->

- [ ] Events
- Event Reason:
- [ ] API .status
- Condition name:
- Other field:
- [ ] Other (treat as last resort)
- Details:
- [x] Other (treat as last resort)
- Details: kube-apiserver logs and audit logs that track eviction requests can be examined to see
if the `UnhealthyPodEvictionPolicy` feature is working properly.

###### What are the reasonable SLOs (Service Level Objectives) for the enhancement?

<!--
This is your opportunity to define what "normal" quality of service looks like
for a feature.

It's impossible to provide comprehensive guidance, but at the very
high level (needs more precise definitions) those may be things like:
- per-day percentage of API calls finishing with 5XX errors <= 1%
- 99% percentile over day of absolute value from (job creation time minus expected
job creation time) for cron job <= 10%
- 99.9% of /health requests per day finish with 200 code

These goals will help you determine what you need to measure (SLIs) in the next
question.
-->
This feature should not have an impact on the eviction request latency or availability.
Eviction requests should follow the [existing latency SLOs](https://github.com/kubernetes/community/blob/master/sig-scalability/slos/slos.md#steady-state-slisslos)
for serving mutating or read-only API calls.

###### What are the SLIs (Service Level Indicators) an operator can use to determine the health of the service?

<!--
Pick one more of these and delete the rest.
-->
The following indicators should conform to the existing kube-apiserver SLIs.

- [ ] Metrics
- Metric name:
- [Optional] Aggregation method:
- Components exposing the metric:
- [ ] Other (treat as last resort)
- Details:
- [x] Metrics
- Metric name: apiserver_request_total
- [Optional] Aggregation method: resource = "pods", subresource = "eviction"
- Components exposing the metric: kube-apiserver
- Metric name: apiserver_request_duration_seconds
- [Optional] Aggregation method: resource = "pods", subresource = "eviction"
- Components exposing the metric: kube-apiserver
atiratree marked this conversation as resolved.
Show resolved Hide resolved

###### Are there any missing metrics that would be useful to have to improve observability of this feature?

<!--
Describe the metrics themselves and the reasons why they weren't added (e.g., cost,
implementation difficulties, etc.).
-->
No

### Dependencies

Expand Down Expand Up @@ -530,6 +516,7 @@ For each of them, fill in the following information by copying the below templat
- 2021-10-24: Proposed KEP for adding the new behavior in alpha status in 1.24.
- 2022-11-11: Initial alpha implementation merged into 1.26
- 2022-12-07: KEP rewritten to match the implementation (PodHealthyPolicy was renamed to UnhealthyPodEvictionPolicy)
- 2023-02-06: Update for beta promotion

## Drawbacks

Expand Down
5 changes: 2 additions & 3 deletions keps/sig-apps/3017-pod-healthy-policy-for-pdb/kep.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ approvers:
see-also:
replaces:

stage: alpha
stage: beta

latest-milestone: "v1.26"
latest-milestone: "v1.27"

# The milestone at which this feature was, or is targeted to be, at each stage.
milestone:
Expand All @@ -40,5 +40,4 @@ feature-gates:
- name: PodDisruptionBudgetPodHealthyPolicy
components:
- kube-apiserver
- kube-controller-manager
disable-supported: true