You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
RFC 952/1123 allows uppercase characters, but IsDNS1123Subdomain does not #71140
I ran into this when trying to start kubelet on a node with an all-caps hostname. The node can't register when its node name defaults to the hostname and the hostname includes capital letters.
What you expected to happen:
They should allow uppercase letters. RFC 952 says "No distinction is made between upper and lower case." RFC 1123 doesn't change that (just allows the first character to be a number).
many object names that use these validation rules are used as labels in kubernetes DNS names (or example, namespace, service, and pod names). Since DNS resolution is case-insensitive, allowing both upper and lower case letters would permit multiple objects to form colliding DNS labels (a service named FOO and a service named foo in the same namespace would produce colliding DNS labels)
the reason the kubelet originally used the detected hostname as the node name was that it was one of the more unique and identifiable attributes available to it. However, the detected hostname is also DNS-based, and should be treated case-insensitively, in this case normalizing to lower-case. Otherwise, different systems can think that case-variants of the same node hostname are actually different nodes. The particular issue of normalizing detected node hostnames to lower case was resolved in 1.12 in b3dfe0c
And for the record, normalizing names would cause churn on things like kubectl apply that we really don't want, I think.
All of Internet goes through that "churn" for what it is worth, because RFC1123, through RFC952, actually mandates it. There is no room for "we don't want to do it for performance reasons" in "No distinction is made between upper and lower case".
It's OK to use your own validation rules. Just don't quote RFC1123 in them, if you can't follow it.
Reacted by dan0delellis, Adam Brodziak, Helge, Kevin Delisle, Ignatius Bramananditya Rivaldi, scaeloutSean and Jan Tomášek
Please can you remove RFC 1123 from error message? I just run into ingress.networking.k8s.io \"test\" is invalid: [spec.rules[0].host: Invalid value: \"TEST-HOSTNAME.LOCAL\": a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*'), spec.tls[0].hosts[0]: Invalid value: \"TEST-HOSTNAME.LOCAL\": a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')
That error message is misleading. Hostnames are case insensitive. If you have to limit case, do it, but make your own excuse. Do not blame 36 year old standard!
The syntax of a legal Internet host name was specified in RFC-952
[DNS:4]. One aspect of host name syntax is hereby changed: the
restriction on the first character is relaxed to allow either a
letter or a digit. Host software MUST support this more liberal
syntax.
RFC 952 says:
ASSUMPTIONS
1. A "name" (Net, Host, Gateway, or Domain name) is a text string up
to 24 characters drawn from the alphabet (A-Z), digits (0-9), minus
sign (-), and period (.). Note that periods are only allowed when
they serve to delimit components of "domain style names". (See
[RFC-921](https://www.rfc-editor.org/rfc/rfc921), "Domain Name System Implementation Schedule", for
background). No blank or space characters are permitted as part of a
name. No distinction is made between upper and lower case. The first
character must be an alpha character.
Activity
astrieanna commentedon Nov 16, 2018
/sig api-machinery
liggitt commentedon Nov 16, 2018
we can change the documentation, but changing the validation rules isn't possible to do compatibly at this point
/kind documentation
astrieanna commentedon Nov 16, 2018
@liggitt could you explain more exactly what would be incompatible?
liggitt commentedon Nov 26, 2018
Two relevant examples:
FOOand a service namedfooin the same namespace would produce colliding DNS labels)jennybuckley commentedon Nov 26, 2018
/cc @jpbetz
thockin commentedon Dec 18, 2018
Why do we need to change it? Case-insensitivity is a great way to write lots of subtle bugs. We didn't do it on purpose.
We could normalize such fields to lower-case, but in general we do not modify user-input like that, so it would be a big deal.
liggitt commentedon Dec 18, 2018
Agree. We should not change the validation rule. We can change the documentation to clarify it must be dns conformant and lowercase
thockin commentedon Dec 18, 2018
And for the record, normalizing names would cause churn on things like
kubectl applythat we really don't want, I think.1 remaining item
freehan commentedon Apr 4, 2019
no fix yet. closing
uppercase is not allowed in labels.
Adding labels to pods (#653)
Adding labels to pods (#653)
document lower case only in app name
[docs] Document lower case only in app name (#5181)
Kubernetes support (#56)
Kubernetes support (#56) (#101)
c3d commentedon Oct 13, 2023
All of Internet goes through that "churn" for what it is worth, because RFC1123, through RFC952, actually mandates it. There is no room for "we don't want to do it for performance reasons" in "No distinction is made between upper and lower case".
It's OK to use your own validation rules. Just don't quote RFC1123 in them, if you can't follow it.
maxlillo commentedon Feb 9, 2024
This is actually quite annoying for automations where you need the hostname the you don't normalize it because of this misimplemented fucntionality
Further restrict uppercase characters in names in the future
Orchard Controller: implement an SSH server that acts as a jump host (#…
semik commentedon Feb 11, 2025
Please can you remove RFC 1123 from error message? I just run into
ingress.networking.k8s.io \"test\" is invalid: [spec.rules[0].host: Invalid value: \"TEST-HOSTNAME.LOCAL\": a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*'), spec.tls[0].hosts[0]: Invalid value: \"TEST-HOSTNAME.LOCAL\": a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')That error message is misleading. Hostnames are case insensitive. If you have to limit case, do it, but make your own excuse. Do not blame 36 year old standard!
RFC 952 says:
thockin commentedon Feb 11, 2025
It says "a lowercase RFC 1123 subdomain ..."
Anyway, I am hoping to make validation errors better in the next few releases, so this will likely be covered.