In this article
Diagnose FQDN hostname construction against the kernel limit before changing DNS resolution settings.
A model Pod stays Pending with ContainerCreating after a long namespace or service subdomain is introduced. With setHostnameAsFQDN enabled, the failure can occur while constructing the kernel hostname, before the application’s DNS queries. Changing resolver search options will not shorten the hostname that kubelet is trying to install.
Read the construction error
Preserve the Pod event and effective hostname, subdomain, namespace and cluster-domain inputs. Kubernetes documents startup failure when the constructed FQDN exceeds the Linux kernel hostname limit of 64 characters. A DNS name can be meaningful to a resolver while still being unsuitable for this kernel field. Identify the failing boundary explicitly.
Understand the optional behavior
Without the option, a Pod’s short hostname and its FQDN are distinct observations. setHostnameAsFQDN asks kubelet to place the FQDN in the Pod namespace’s hostname field. It does not merely add another DNS record. Confirm that the application actually needs that kernel identity instead of enabling the option as a generic DNS improvement.
Calculate the effective identity
Build the full name from the actual admitted fields and cluster domain, including separators. Do not check only the visible Pod name or a short development namespace. Generated controller names and longer environment names can change the result. Preserve the final string’s length in diagnostics without copying unrelated secret environment values or request contents.
Choose a scoped correction
A shorter relevant name or removal of an unnecessary FQDN-hostname requirement can address this boundary, subject to the application’s identity contract. DNS search tuning, opening network policy or restarting DNS servers targets a different mechanism. Review downstream certificate and service-discovery assumptions before changing names so the startup correction does not create a new identity mismatch.
Exercise the boundary safely
Use an innocuous disposable Pod to compare a name within the documented limit with an intentionally overlong constructed name. Confirm events and the observed kernel hostname for the successful case. Success explains this startup failure; it does not validate DNS reachability, TLS identity, service endpoint readiness or whether the model application chooses the correct advertised hostname for its clients.
Primary references
Linux gethostname and sethostname.
Related reading: Slow DNS in a Pod: search domains and ndots; Some DNS queries fail: why TCP and UDP port 53 both matter.
Earn rental income from GPUs
Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.