Pod Scheduling
Pod affinity and antiaffinity
- In this example we had tried to place a pod B
- We want to run the affinity pod on the same node as pod B
same node = topology. Topology for node is host name and we want to run antiaffinity pod on the different node - Refer Here for the specs
- apply the manifests

node affinity
- Refer Here for node affinity
- Refer Here for differences between nodeselector and node affinity
Taint and toleration
- Refer Here for official docs
- Lets apply a taint for node1
kubectl taint nodes aks-nodepool1-19501529-vmss000000 team=devops:NoSchedule
- Lets create two pods one with toleration and other without toleration
-
Refer Here for manifests
- Note: We can try Priority class to assign pods a priority
Persistent Volumes in Kubernetes
- Kuberenetes implements Storage as CSI. There are lots of vendors who provide CSI implementations Refer Here
- The interaction with storage is done by CSI
- k8s interacts with CSI to deal with storage
- This option enables dynamic provisioning also
- In managed k8s we have storage classes

- We can initiate a request from pod for a PersistentVolume (PV) which is referred as Persistent Volume Claim (PVC)
- Lets create a mysql pod with a Persistent volume
-
Lets create pvc and apply
- Lets apply the pod with pvc



- Connect to database and insert some records

- Now lets delete the pod and recreate the pod by applying the manifest
- Refer Here
- To statically provision volume Refer Here
- Refer Here for reclaim policy
