148422597X Kubernetes Management Design Patterns [Vohra 2017-01-29] {E559F6BB}

marco.cirilli
from marco.cirilli More from this publisher
19.06.2021 Views

Chapter 9 ■ Scheduling Pods on NodesFigure 9-48. Setting another-annotation-key and removing nodeSelectorDelete the pod with-labels and create the pod again. The pod is scheduled on the node with the labelkubernetes.io/image-name: nginx2, as indicated by the NODE in the pod listing in Figure 9-49.Figure 9-49. The pod is scheduled on another-annotation-key valued nodeSetting preferredDuringSchedulingIgnoredDuringExecutionIn this section we will use the node affinity preferredDuringSchedulingIgnoredDuringExecution, whichis only a hint to the scheduler and not guaranteed. A slightly different set of node values is used for theexample, as shown in Figure 9-50.229

Chapter 9 ■ Scheduling Pods on NodesFigure 9-50. Listing nodes used for node affinity preferredDuringSchedulingIgnoredDuringExecutionexampleSet the label key kubernetes.io/image-name to nginx on one of the nodes and hello-world on anothernode as shown in Figure 9-51. The third node is kept unlabeled.Figure 9-51. Setting node labelsList the labels for each node as shown in Figure 9-52.Figure 9-52. Listing node labels230

Chapter 9 ■ Scheduling Pods on Nodes

Figure 9-50. Listing nodes used for node affinity preferredDuringSchedulingIgnoredDuringExecution

example

Set the label key kubernetes.io/image-name to nginx on one of the nodes and hello-world on another

node as shown in Figure 9-51. The third node is kept unlabeled.

Figure 9-51. Setting node labels

List the labels for each node as shown in Figure 9-52.

Figure 9-52. Listing node labels

230

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!