<p>We are running an application inside a cluster we created in GKE. We have created required yamls (consisting of Service and Deployment definition). We recently have decided to use Pod Topology for that I have added following piece in my Deployment yaml file under spec section-</p>
<pre><code> spec:
  topologySpreadConstraints:
  - maxSkew: 1
    topologyKey: node
    whenUnsatisfiable: DoNotSchedule
    labelSelector:
      matchLabels:
        app: foo-app
</code></pre>
<p>This change is working as expected when I am running the service inside a minikube cluster while the same change is not working inside a GKE cluster. It throws an error-</p>
<pre><code>Error: UPGRADE FAILED: error validating &quot;&quot;: error validating data: ValidationError(Deployment.spec.template.spec): unknown field &quot;topologySpreadConstraints&quot; in io.k8s.api.core.v1.PodSpec
</code></pre>
<p>I searched a lot but could not find a satisfactory answer. Has anybody faced this problem? Please help me understand the problem and its resolution.</p>
<p>Thanks in Advance.</p>

<p>I assume you are running <code>1.17.7-gke.17</code> on your GKE cluster. Unfortunately this is the latest version you can upgrade to, through the <a href="https://cloud.google.com/kubernetes-engine/docs/release-notes-rapid" rel="nofollow noreferrer">rapid channel</a>, at the time of this post.</p>
<p><code>topologySpreadConstraints</code> is available in Kubernetes v1.18 <a href="https://kubernetes.io/docs/concepts/workloads/pods/pod-topology-spread-constraints/" rel="nofollow noreferrer">FEATURE STATE: [beta]</a></p>
