<p>Following this tutorial ( <a href="https://portworx.com/run-ha-kafka-azure-kubernetes-service/" rel="nofollow noreferrer">https://portworx.com/run-ha-kafka-azure-kubernetes-service/</a>) to setup a Kafka cluster on Azure Kubernetes Service, I am running in an issue deploying the Headless Zookeeper service.  </p>

<p>Running this yml with kubectl to deploy the Zookeeper service, I get the error below.</p>

<pre><code>apiVersion: v1
kind: Service
metadata:
  name: zk-headless
nodeAffinity:  labels:
    app: zk-headless
spec:
  ports:
  - port: 2888
    name: server
  - port: 3888
    name: leader-election
  clusterIP: None
  selector:
    app: zk
</code></pre>

<pre><code>error converting YAML to JSON: yaml: line 5: mapping values are not allowed in this context
</code></pre>

<p>My question is, how do I assign the nodeAffinity value?  Should I use this:  </p>

<pre><code>requiredDuringSchedulingIgnoredDuringExecution:
        nodeSelectorTerms:
</code></pre>

andy
<p>Kubernetes <code>Service</code> objects do not have a <code>nodeAffinity</code> field, since <code>Service</code> resources do not run on nodes. In fact, they don't "run" at all - they are rather rules for the networking.</p>

<p>The example provided on the website has a copy-paste error there. It should have been:</p>

<pre><code>apiVersion: v1
kind: Service
metadata:
  name: zk-headless
  labels:
    app: zk-headless
spec:
  ports:
    - port: 2888
      name: server
    - port: 3888
      name: leader-election
  clusterIP: None
  selector:
    app: zk
</code></pre>
