 What is affinity? We've seen pain to avoid scheduling certain pods in certain nodes in the previous video. Affinity is the opposite. It lets you define some kind of affinity between pods and nodes. Let's define a node affinity. A node affinity is a way to set where we want to run a pod. In this case, we've got a deployment here. And here there is a section called affinity node affinity. So we are setting an affinity of kind node. So we are choosing the nodes where we want to run this pod. And in this case, what we are setting here is that my pod should only run on nodes that are labeled with the key color and the value of blue. Currently, there is no node with this label. So I'm going to do a key color applied in this app. Apps, Q files, myboot, node affinity. And if I do a key color get pods, you'll see that it's impending. And it's impending because there is no node with these labels. Let me do a key color. Let me choose one of these nodes and do a key color label node. This with color equal blue. So I'm just adding a label to this node. Now I can do a key color get pods. And you'll see that now it's running and it's running in that node because that node contains the label. And we'll do another leaf of this. And let's show you, let me show you another example of pod affinity. A pod affinity is something different. What you are configuring here is that two pods must run in the same node all the time. So it's not an affinity between pod and a node, but the affinity between two pods. In this case, I'm just adding an affinity of this pod, myboot2, an affinity with a pod that contains a label with key at APB and values of myboot. So if I now do a Q color, Q color line in this app, apps, Q files, myboot, pod, affinity. You'll see that the pod now is impending because there is no pod deployed with or matching these conditions. But if I do Q color apply minus f, apps, Q files, myboot, deployment. And this file contains a label with these values. You can see it. You see here that I've got a label APB myboot. Now with the Q color pod, you'll see that both are running. And now this one is running because there is another pod with the specified label. And both of them running in the same nodes. Thanks for watching and don't forget to like the video and subscribe to the channel.