// Module included in the following assemblies:
//
// assembly-scheduling.adoc

[id='proc-configuring-node-affinity-{context}']
= Configuring node affinity in Kafka components

.Prerequisites

* A Kubernetes cluster
* A running Cluster Operator

.Procedure

. Label the nodes where Strimzi components should be scheduled.
+
This can be done using `kubectl label`:
[source,shell,subs="+quotes,attributes+"]
kubectl label node _NAME-OF-NODE_ node-type=fast-network
+
Alternatively, some of the existing labels might be reused.
. Edit the `affinity` property in the resource specifying the cluster deployment.
For example:
+
[source,yaml,subs=attributes+]
----
apiVersion: {KafkaApiVersion}
kind: Kafka
spec:
  kafka:
    # ...
    template:
      pod:
        affinity:
          nodeAffinity:
            requiredDuringSchedulingIgnoredDuringExecution:
              nodeSelectorTerms:
                - matchExpressions:
                  - key: node-type
                    operator: In
                    values:
                    - fast-network
    # ...
  zookeeper:
    # ...
----

. Create or update the resource.
+
This can be done using `kubectl apply`:
[source,shell,subs="+quotes,attributes+"]
kubectl apply -f _KAFKA-CONFIG-FILE_
