<p>I created a gossip cluster in AWS using <strong>kops</strong>, which means my cluster name is  ending with <strong>k8s.local</strong> (clusters.test.k8s.local to be exected ),
All is working fine until I tried to create a deployment where the pod name needs to be with a domain at the end (api-manager.iot.test.co.nz).</p>

<p>I know that it is not authorized to create pods that are not standing in the requirements os this regex:</p>

<pre><code>'[a-z]([-a-z0-9]*[a-z0-9])?'
</code></pre>

<p>Is there a way I can do that?</p>

<p>I tried adding hostname under template->spec but it has the same restrictions (the regex).</p>

<p>This is my deployment YAML file:</p>

<pre><code>apiVersion: apps/v1beta1
kind: Deployment
metadata:
  labels:
  name: api-manager
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: api-manager
    spec:
      volumes:
       - name: api-manager-efs
         persistentVolumeClaim:
          claimName: pvc-apim
      containers:
      - image: api-manager:2.1.0
        name: api-manager.iot.test.co.nz
        ports:
        - name: porta 
          containerPort: 9763
        - name: portb
          containerPort: 9443         
        env:
        - name: SLEEP
          value: "30"

        volumeMounts:
        - name: api-manager-efs
          mountPath: /home/wso2carbon/wso2am-2.1.0/repository 
</code></pre>

<p>No, you cannot create that kind of <code>labels</code> by design.</p>

<p>From the design <a href="https://github.com/kubernetes/community/blob/master/contributors/design-proposals/architecture/identifiers.md" rel="nofollow noreferrer">document</a>:</p>

<blockquote>
  <p><a href="http://www.ietf.org/rfc/rfc1035.txt" rel="nofollow noreferrer">rfc1035</a>/<a href="http://www.ietf.org/rfc/rfc1123.txt" rel="nofollow noreferrer">rfc1123</a> <code>label</code> (DNS_LABEL): An alphanumeric (a-z, and 0-9) string, with a maximum length of 63 characters, with the '-' character allowed anywhere except the first or last character, suitable for use as a hostname or segment in a domain name.</p>
</blockquote>

<p>Here is the current <a href="https://github.com/kubernetes/kubernetes/blob/HEAD/staging/src/k8s.io/apimachinery/pkg/util/validation/validation.go#L145" rel="nofollow noreferrer">implementation</a>:</p>

<pre><code>const dns1035LabelFmt string = "[a-z]([-a-z0-9]*[a-z0-9])?"
const dns1035LabelErrMsg string = "a DNS-1035 label must consist of lower case alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character"
const DNS1035LabelMaxLength int = 63

var dns1035LabelRegexp = regexp.MustCompile("^" + dns1035LabelFmt + "$")

// IsDNS1035Label tests for a string that conforms to the definition of a label in
// DNS (RFC 1035).
func IsDNS1035Label(value string) []string {
    var errs []string
    if len(value) &gt; DNS1035LabelMaxLength {
        errs = append(errs, MaxLenError(DNS1035LabelMaxLength))
    }
    if !dns1035LabelRegexp.MatchString(value) {
        errs = append(errs, RegexError(dns1035LabelErrMsg, dns1035LabelFmt,     "my-name", "abc-123"))
    }
    return errs
}
</code></pre>
