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

kubeadm: perform a host name check on init / join #99194

Merged
merged 1 commit into from Feb 21, 2021

Conversation

pacoxu
Copy link
Member

@pacoxu pacoxu commented Feb 18, 2021

What type of PR is this?

/kind feature
small enhancement

What this PR does / why we need it:

#99156 (comment)

Which issue(s) this PR fixes:

Make it clear during kubeadm join. User may encounter an issue like #99156.
Longer node name may lead to label adding problem and so on.

Special notes for your reviewer:

The host name will be used as the machine name and will be used as the DNS suffix, so the host name must meet the hostname specification defined by RFC 1123. Hostname should be less than 63 characters and satisfy regular expression ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$

Does this PR introduce a user-facing change?

kubeadm: during "init" and "join" perform preflight validation on the host / node name and throw warnings if a name is not compliant

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


@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. 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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. 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. labels Feb 18, 2021
@k8s-ci-robot k8s-ci-robot added area/kubeadm sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Feb 18, 2021

if len(hc.nodeName) > 63 {
warnings = append(warnings, errors.Errorf("hostname \"%s\" should be no more than 63 characters. Change hostname or use --node-name flag to override it", hc.nodeName))
}
Copy link
Member

Choose a reason for hiding this comment

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

i would like to understand more about the kubelet requirements before applying such a change.
#99156

aren't we supposed to use IsQualifiedName() instead of pining to 63?

Copy link
Member

Choose a reason for hiding this comment

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

#99156

this is closed, until further notice.
does the kubelet actually impose validation and limitation to the hostnames the user can pass to it?

Copy link
Member Author

Choose a reason for hiding this comment

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

kubelet doesn't validate it, but hostname is used in some other features like node-label selector and static-pod suffix.

If it is too long, something may not work. So I think we should add a warning here.
As this is not strictly limited, it is not an error.

Copy link
Member

@neolit123 neolit123 Feb 19, 2021

Choose a reason for hiding this comment

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

true, we are adding a warning here in kubeadm and that's fine, but i'm wondering about a few things when a Node name is too long:

  • does the bootstrap finish OK (i.e. node joins the cluster)?
  • can pods still schedule on this node?
    i guess i can try some of these things myself..

i'm asking because maybe the kubelet should also error out on long names (separate PR).
but if some of that partially works such a change in the kubelet would need an "action required" because otherwise it will break some users.

Copy link
Member Author

Choose a reason for hiding this comment

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

Add to my todo list on kubelet/sig-node

@pacoxu
Copy link
Member Author

pacoxu commented Feb 19, 2021

Updated PR with IsQualifiedName.

Co-authored-by: Lubomir I. Ivanov <neolit123@gmail.com>
@pacoxu
Copy link
Member Author

pacoxu commented Feb 20, 2021

/retest

@pacoxu
Copy link
Member Author

pacoxu commented Feb 20, 2021

/test pull-kubernetes-e2e-kind
for flake of test/e2e/storage/persistent_volumes-local.go:214

Copy link
Member

@neolit123 neolit123 left a comment

Choose a reason for hiding this comment

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

/triage accepted
/approve
/priority backlog

this seems fine to me.

this check will be run on both init and join. so we should change the release note to:

kubeadm: during "init" and "join" perform preflight validation on the host / node name and throw warnings if a name is not compliant

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. priority/backlog Higher priority than priority/awaiting-more-evidence. and removed 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. labels Feb 20, 2021
@neolit123
Copy link
Member

/retest

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: neolit123, pacoxu

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 Feb 20, 2021
@neolit123
Copy link
Member

/retitle kubeadm: perform a host name check on init / join

@k8s-ci-robot k8s-ci-robot changed the title add hostname check in kubeadm join kubeadm: perform a host name check on init / join Feb 20, 2021
@pacoxu
Copy link
Member Author

pacoxu commented Feb 20, 2021

/retest

Copy link
Member

@neolit123 neolit123 left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 20, 2021
@pacoxu
Copy link
Member Author

pacoxu commented Feb 20, 2021

/retest
for flake

@pacoxu
Copy link
Member Author

pacoxu commented Feb 20, 2021

/retest
flake local volume test

@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

@pacoxu
Copy link
Member Author

pacoxu commented Feb 21, 2021

/retest
x 6

@pacoxu
Copy link
Member Author

pacoxu commented Feb 21, 2021

/retest
x 7

@k8s-ci-robot k8s-ci-robot merged commit d475352 into kubernetes:master Feb 21, 2021
@k8s-ci-robot k8s-ci-robot added this to the v1.21 milestone Feb 21, 2021
@pacoxu pacoxu deleted the fix/kubeadm-hostnamecheck branch June 23, 2021 05:42
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/kubeadm 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. priority/backlog Higher priority than priority/awaiting-more-evidence. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. 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
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants