19.06.2021 Views

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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 9 ■ Scheduling Pods on Nodes

Table 9-2. (continued)

Priority Function

ImageLocalityPriority

NodeAffinityPriority

Description

The objective is to schedule on nodes that already have some or all

of the image packages installed. A node with the larger size of the

already installed packages is preferred.

Evaluate node affinity using

preferredDuringSchedulingIgnoredDuringExecution and

requiredDuringSchedulingIgnoredDuringExecution.

The final node ranking is calculated using a weighted priority function score. Each node is given a score

in the range of 1–10 for each of the applied priority functions, and the final score is calculated by assigning

a weight for each priority function. For example, given three priority functions priorityFunc1Score,

priorityFunc2Score, and priorityFunc3Score, the final score is calculated as follows:

RankingScoreNodeA = (weight1 * priorityFunc1Score) + (weight2 * priorityFunc2Score) +

(weight3 * priorityFunc3Score)

The node with the highest score is selected for scheduling a pod.

The default scheduling policy as determined by default predicates and priority functions may be

customized or overridden using one of the following procedures:

1. Use a --policy-config-file parameter to the scheduler. The policy config file

is a json file, for example https://github.com/kubernetes/kubernetes/blob/

master/examples/scheduler-policy-config.json.

2. Modify the default predicates and/or priority functions in plugin/pkg/

scheduler/algorithm/predicates/predicates.go and/or plugin/pkg/

scheduler/algorithm/priorities/priorities.go respectively and register the

policy in defaultPredicates() and/or defaultPriorities() in plugin/pkg/

scheduler/algorithmprovider/defaults/defaults.go.

Setting the Environment

We shall be using a CoreOS-based AWS EC2 Cloud Formation to run a one-controller-three-worker-node

Kubernetes cluster. Start an EC2 instance using Amazon Linux AMI. SSH log in to the EC2 instance:

ssh -i docker.pem ec2-user@54.197.206.44

Start a cloud configuration for a Kubernetes cluster and register the Public IP address of the controller

in the Public DNS name. While configuring the cluster set the Kubernetes version to v1.3.0_coreos.1 in the

kubernetesVersion field in cluster.yaml.

Install the kubectl binaries. Both the Client and Server versions should be 1.3, as shown in Figure 9-2.

202

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

Saved successfully!

Ooh no, something went wrong!