148422597X Kubernetes Management Design Patterns [Vohra 2017-01-29] {E559F6BB}
Chapter 9 ■ Scheduling Pods on NodesFigure 9-59. Setting all the kubernetes.io/image-name key values to non existing valuesDelete the pod with-labels and create the pod again. The pod is still scheduled even though none ofthe nodes have matching labels, as shown in Figure 9-60. By comparison, when we used the node affinityrequiredDuringSchedulingIgnoredDuringExecution with none of the nodes having matching labels, thepods were placed in Pending status until a matching label was added. Now the pod is scheduled because thepreferredDuringSchedulingIgnoredDuringExecution setting is not binding and is only a hint.Figure 9-60. Pods are scheduled even though no nodes with matching labels are foundThe nodeSelector field if specified with node affinity preferredDuringSchedulingIgnoredDuringExecutionis still guaranteed. Add the nodeSelector field with the label kubernetes.io/image-name: nginx as shown inFigure 9-61. All the other matching expressions are set to kubernetes.io/image-name: hello-world.235
Chapter 9 ■ Scheduling Pods on NodesFigure 9-61. Setting nodeSelector in addiiton to node affinitypreferredDuringSchedulingIgnoredDuringExecutionDelete and create the with-labels pod again. The pod is scheduled on the node with kubernetes.io/image-name: nginx label because the nodeSelector expression is kubernetes.io/image-name: nginx asshown in Figure 9-62.Figure 9-62. The pod is scheduled on the node with label matching the nodeSelector expressionSummaryIn this chapter we first discussed the default scheduling policy used by Kubernetes. Then we used the defaultscheduler and also the node selector to schedule pods on nodes. We also discussed scheduling pods usingnode affinity. In the next chapter we shall discuss configuring compute resources.236
- Page 199 and 200: Chapter 8 ■ Using Rolling Updates
- Page 201 and 202: Chapter 8 ■ Using Rolling Updates
- Page 203 and 204: Chapter 8 ■ Using Rolling Updates
- Page 205 and 206: Chapter 8 ■ Using Rolling Updates
- Page 207 and 208: Chapter 8 ■ Using Rolling Updates
- Page 209 and 210: Chapter 8 ■ Using Rolling Updates
- Page 211 and 212: Chapter 8 ■ Using Rolling Updates
- Page 213 and 214: Chapter 8 ■ Using Rolling Updates
- Page 215 and 216: Chapter 9 ■ Scheduling Pods on No
- Page 217 and 218: Chapter 9 ■ Scheduling Pods on No
- Page 219 and 220: Chapter 9 ■ Scheduling Pods on No
- Page 221 and 222: Chapter 9 ■ Scheduling Pods on No
- Page 223 and 224: Chapter 9 ■ Scheduling Pods on No
- Page 225 and 226: Chapter 9 ■ Scheduling Pods on No
- Page 227 and 228: Chapter 9 ■ Scheduling Pods on No
- Page 229 and 230: Chapter 9 ■ Scheduling Pods on No
- Page 231 and 232: Chapter 9 ■ Scheduling Pods on No
- Page 233 and 234: Chapter 9 ■ Scheduling Pods on No
- Page 235 and 236: Chapter 9 ■ Scheduling Pods on No
- Page 237 and 238: Chapter 9 ■ Scheduling Pods on No
- Page 239 and 240: Chapter 9 ■ Scheduling Pods on No
- Page 241 and 242: Chapter 9 ■ Scheduling Pods on No
- Page 243 and 244: Chapter 9 ■ Scheduling Pods on No
- Page 245 and 246: Chapter 9 ■ Scheduling Pods on No
- Page 247 and 248: Chapter 9 ■ Scheduling Pods on No
- Page 249: Chapter 9 ■ Scheduling Pods on No
- Page 253 and 254: Chapter 10 ■ Configuring Compute
- Page 255 and 256: Chapter 10 ■ Configuring Compute
- Page 257 and 258: Chapter 10 ■ Configuring Compute
- Page 259 and 260: Chapter 10 ■ Configuring Compute
- Page 261 and 262: Chapter 10 ■ Configuring Compute
- Page 263 and 264: Chapter 10 ■ Configuring Compute
- Page 265 and 266: Chapter 10 ■ Configuring Compute
- Page 267 and 268: Chapter 10 ■ Configuring Compute
- Page 269 and 270: Chapter 10 ■ Configuring Compute
- Page 271 and 272: Chapter 10 ■ Configuring Compute
- Page 273 and 274: Chapter 11 ■ Using ConfigMapsIn t
- Page 275 and 276: Chapter 11 ■ Using ConfigMapsFigu
- Page 277 and 278: Chapter 11 ■ Using ConfigMapsNext
- Page 279 and 280: Chapter 11 ■ Using ConfigMapsThe
- Page 281 and 282: Chapter 11 ■ Using ConfigMapsCrea
- Page 283 and 284: Chapter 11 ■ Using ConfigMapsFigu
- Page 285 and 286: Chapter 11 ■ Using ConfigMapsCrea
- Page 287 and 288: Chapter 11 ■ Using ConfigMapsFigu
- Page 289 and 290: Chapter 11 ■ Using ConfigMapsCons
- Page 291 and 292: Chapter 11 ■ Using ConfigMapsmoun
- Page 293 and 294: CHAPTER 12Using Resource QuotasIn C
- Page 295 and 296: Chapter 12 ■ Using Resource Quota
- Page 297 and 298: Chapter 12 ■ Using Resource Quota
- Page 299 and 300: Chapter 12 ■ Using Resource Quota
Chapter 9 ■ Scheduling Pods on Nodes
Figure 9-59. Setting all the kubernetes.io/image-name key values to non existing values
Delete the pod with-labels and create the pod again. The pod is still scheduled even though none of
the nodes have matching labels, as shown in Figure 9-60. By comparison, when we used the node affinity
requiredDuringSchedulingIgnoredDuringExecution with none of the nodes having matching labels, the
pods were placed in Pending status until a matching label was added. Now the pod is scheduled because the
preferredDuringSchedulingIgnoredDuringExecution setting is not binding and is only a hint.
Figure 9-60. Pods are scheduled even though no nodes with matching labels are found
The nodeSelector field if specified with node affinity preferredDuringSchedulingIgnoredDuringExecution
is still guaranteed. Add the nodeSelector field with the label kubernetes.io/image-name: nginx as shown in
Figure 9-61. All the other matching expressions are set to kubernetes.io/image-name: hello-world.
235