Kubernetes Replication Controller name is not RFC1035 compliant

4/4/2017

While trying out a sample kubernetes python client from https://github.com/kubernetes-incubator/client-python/blob/master/examples/exec.py I get an error saying that the replication controller name must match the regex a-z0-9?(\.a-z0-9?)* when I try out a name "My-Whole-World". As per the regex printed in the error message this is expected, though when check the Kubernetesdocumentation page at https://kubernetes.io/docs/tutorials/stateless-application/run-stateless-ap-replication-controller/#resizing-a-replication-controller I see that the name must be RFC1035 compliant. Now the regex printed in the error message does not look compliant to RFC1035 regex (Regular Expression for validating DNS label ( host name)). This looks like a bug in kubernetes. Can anyone confirm this?

-- pawan
kubernetes

1 Answer

4/7/2017

TL;DR:

The document seems to have old invalid information. ReplicationControllers conform to RFC 1123.

Code Traversal:

To validate replication controller this is used ValidateReplicationControllerName which is basically a function called NameIsDNSSubdomain

This in turn calls IsDNS1123Subdomain so this final function is doing validation based on RFC 1123.

There a line says:

a DNS-1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character

-- surajd
Source: StackOverflow