<p>I have a deployment yaml file that looks like this:</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: hello-kubernetes
spec:
  replicas: 1
  selector:
    matchLabels:
      app: hello-kubernetes
  template:
    metadata:
      labels:
        app: hello-kubernetes
    spec:
      setHostnameAsFQDN: true
      hostname: hello
      subdomain: world
      containers:
      - name: hello-kubernetes
        image: redis 
</code></pre>
<p>However, I am getting this error:</p>
<pre><code>$ kubectl apply -f dep.yaml  

error: error validating &quot;dep.yaml&quot;: error validating data: ValidationError(Deployment.spec.template.spec): unknown field &quot;setHostnameAsFQDN&quot; in io.k8s.api.core.v1.PodSpec; if you choose to ignore these errors, turn validation off with --validate=false
</code></pre>
<p>My kubectl version:</p>
<pre><code>$ kubectl version --client
Client Version: version.Info{Major:&quot;1&quot;, Minor:&quot;20&quot;, GitVersion:&quot;v1.20.0&quot;, GitCommit:&quot;af46c47ce925f4c4ad5cc8d1fca46c7b77d13b38&quot;, GitTreeState:&quot;clean&quot;, BuildDate:&quot;2020-12-08T17:59:43Z&quot;, GoVersion:&quot;go1.15.5&quot;, Compiler:&quot;gc&quot;, Platform:&quot;darwin/amd64&quot;}
</code></pre>
<p>After specifying <code>--validate=falsee</code>, <code>hostname</code> and <code>hostname -f</code> still return different values.</p>
<p>I believe I missunderstood something. Doc says that <code>setHostnameAsFQDN</code> will be available from kubernetes v1.20</p>

<p>You showed <code>kubectl</code> version. Your kubernetes version also need to be v1.20.  Make sure you are using kubernetes version v1.20.</p>
<p>Use <code>kubectl version</code> for seeing both client and server version. Where client version refers to <code>kubectl</code> version and server version refers to <code>kubernetes</code> version.</p>
<p>As far the k8s v1.20 release note doc: Previously introduced in 1.19 behind a feature gate, <code>SetHostnameAsFQDN</code>  is now enabled by default. More details on this behavior is available in <a href="https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#pod-sethostnameasfqdn-field" rel="nofollow noreferrer">documentation for DNS for Services and Pods</a></p>
