Skip to content

Conversation

@ahmetb
Copy link
Member

@ahmetb ahmetb commented Jun 13, 2024

What type of PR is this?

/kind feature
/sig node

What this PR does / why we need it:

Problem:

When a Pod fails to start due to kubelet-side admission checks, kubelet reports v1/Event for the Pod using the following event payload format:

Reason="NodeAffinity" Message="Predicate NodeAffinity failed"
Reason="NodeName" Message="Predicate NodeName failed"
Reason="NodePorts" Message="Predicate NodePorts failed"

This is not super helpful, to especially to beginners who do not know that kubelet does admission checks after a pod that's scheduled and ran on the host before. It's also unclear the what the names of predicates refer to.

Solution:

Expose human-readable predicate description in the failure so that kubelet submits an Event with this description, such as:

Reason="NodeAffinity" Message="Predicate NodeAffinity failed: node(s) didn't match Pod's node affinity/selector"
Reason="NodeName" Message="Predicate NodeName failed: node(s) didn't match the requested node name"
Reason="NodePorts" Message="Predicate NodePorts failed: node(s) didn't have free ports for the requested pod ports"

Which issue(s) this PR fixes:

N/A - have not opened an issue since it's a small change that seems rather inconsequential.

Special notes for your reviewer:

Tested with a new kubelet build from HEAD in kind, and triggering the predicate failures listed above.

Does this PR introduce a user-facing change?

NONE

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:

**Problem:** When a Pod fails to run due to kubelet-side admission checks, the
v1.Event objects emitted looks like these:

    Reason="NodeAffinity" Message="Predicate NodeAffinity failed"
    Reason="NodeName" Message="Predicate NodeName failed"
    Reason="NodePorts" Message="Predicate NodePorts failed"

**Solution:** Expose human-readable predicate description in the failure
so that kubelet submits an Event with this description, such as:

    Reason="NodeAffinity" Message="Predicate NodeAffinity failed: node(s) didn't match Pod's node affinity/selector"
    Reason="NodeName" Message="Predicate NodeName failed: node(s) didn't match the requested node name"
    Reason="NodePorts" Message="Predicate NodePorts failed: node(s) didn't have free ports for the requested pod ports"
@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/feature Categorizes issue or PR as related to a new feature. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. sig/node Categorizes an issue or PR as relevant to SIG Node. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. area/kubelet labels Jun 13, 2024
@bart0sh
Copy link
Contributor

bart0sh commented Jun 26, 2024

/triage accepted
/lgtm

/assign @mrunalp
for approval

@k8s-ci-robot k8s-ci-robot added the triage/accepted Indicates an issue or PR is ready to be actively worked on. label Jun 26, 2024
@k8s-ci-robot k8s-ci-robot added lgtm "Looks good to me", indicates that a PR is ready to be merged. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Jun 26, 2024
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: fde9535f5c81974b7dd6171932e729f9fd85307b

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ahmetb, mrunalp

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 1, 2024
@k8s-ci-robot k8s-ci-robot merged commit 0c8dc93 into kubernetes:master Jul 2, 2024
@k8s-ci-robot k8s-ci-robot added this to the v1.31 milestone Jul 2, 2024
@balraj-aqfer
Copy link

@ahmetb "kubelet does admission checks after a pod that's scheduled" . Do we have any doc to explain this concept?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. area/kubelet cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. release-note-none Denotes a PR that doesn't merit a release note. sig/node Categorizes an issue or PR as relevant to SIG Node. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.

Projects

Development

Successfully merging this pull request may close these issues.

5 participants