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

[id='proc-dedicated-nodes-{context}']
= Setting up dedicated nodes and scheduling pods on them

.Prerequisites

* A Kubernetes cluster
* A running Cluster Operator

.Procedure

. Select the nodes which should be used as dedicated.
. Make sure there are no workloads scheduled on these nodes.
. Set the taints on the selected nodes:
+
This can be done using `kubectl taint`:
[source,shell,subs=+quotes]
kubectl taint node _NAME-OF-NODE_ dedicated=Kafka:NoSchedule
+
. Additionally, add a label to the selected nodes as well.
+
This can be done using `kubectl label`:
[source,shell,subs=+quotes]
kubectl label node _NAME-OF-NODE_ dedicated=Kafka
+
. Edit the `affinity` and `tolerations` properties in the resource specifying the cluster deployment.
+
For example:
+
[source,yaml,subs=attributes+]
----
apiVersion: {KafkaApiVersion}
kind: Kafka
spec:
  kafka:
    # ...
    template:
      pod:
        tolerations:
          - key: "dedicated"
            operator: "Equal"
            value: "Kafka"
            effect: "NoSchedule"
        affinity:
          nodeAffinity:
            requiredDuringSchedulingIgnoredDuringExecution:
              nodeSelectorTerms:
              - matchExpressions:
                - key: dedicated
                  operator: In
                  values:
                  - Kafka
    # ...
  zookeeper:
    # ...
----

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