Skip to content

Commit

Permalink
Merge pull request openshift#32472 from mburke5678/declarative-statem…
Browse files Browse the repository at this point in the history
…ents-node

GH#1944035: Adding declarative statements for Nodes and MCO topics
  • Loading branch information
mburke5678 authored Jun 24, 2021
2 parents 8b3e7fb + 2c2e725 commit 64e163c
Show file tree
Hide file tree
Showing 27 changed files with 880 additions and 38 deletions.
15 changes: 15 additions & 0 deletions _unused_topics/nodes-cluster-overcommit-node-memory.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,21 @@ metadata:
----
$ oc label machineconfigpool worker custom-kubelet=small-pods
----
+
[TIP]
====
You can alternatively apply the following YAML to add the label:
[source,yaml]
----
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineConfigPool
metadata:
labels:
custom-kubelet: small-pods
name: worker
----
====

.Procedure

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ You can configure two types of node affinity rules: required and preferred.

== Configuring a required node affinity rule

Required rules *must* be met before a pod can be scheduled on a node.
Required rules *must* be met before a pod can be scheduled on a node.

.Procedure

Expand All @@ -20,6 +20,21 @@ The following steps demonstrate a simple configuration that creates a node and a
----
$ oc label node node1 e2e-az-name=e2e-az1
----
+
[TIP]
====
You can alternatively apply the following YAML to add the label:
[source,yaml]
----
kind: Node
apiVersion: v1
metadata:
name: <node_name>
labels:
e2e-az-name: e2e-az1
----
====

. In the pod specification, use the `nodeAffinity` stanza to configure the `requiredDuringSchedulingIgnoredDuringExecution` parameter:
+
Expand Down
63 changes: 63 additions & 0 deletions _unused_topics/nodes-scheduler-taints-tolerations-examples.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,27 @@ For example:
----
$ oc adm taint nodes node1 dedicated=groupName:NoSchedule
----
+
[TIP]
====
You can alternatively apply the following YAML to add the taint:
[source,yaml]
----
kind: Node
apiVersion: v1
metadata:
name: <node_name>
labels:
...
spec:
taints:
- key: dedicated
value: groupName
effect: NoSchedule
...
----
====

. Add a corresponding toleration to the pods by writing a custom admission controller.
+
Expand All @@ -48,6 +69,27 @@ For example:
----
$ oc adm taint nodes node1 dedicated=groupName:NoSchedule
----
+
[TIP]
====
You can alternatively apply the following YAML to add the taint:
[source,yaml]
----
kind: Node
apiVersion: v1
metadata:
name: <node_name>
labels:
...
spec:
taints:
- key: dedicated
value: groupName
effect: NoSchedule
...
----
====

. Add a corresponding toleration to the pods by writing a custom admission controller.
+
Expand All @@ -70,6 +112,27 @@ To ensure pods are blocked from the specialized hardware:
$ oc adm taint nodes <node-name> disktype=ssd:NoSchedule
$ oc adm taint nodes <node-name> disktype=ssd:PreferNoSchedule
----
+
[TIP]
====
You can alternatively apply the following YAML to add the taint:
[source,yaml]
----
kind: Node
apiVersion: v1
metadata:
name: <node_name>
labels:
...
spec:
taints:
- key: disktype
value: ssd
effect: PreferNoSchedule
...
----
====

. Adding a corresponding toleration to pods that use the special hardware using an admission controller.

Expand Down
24 changes: 22 additions & 2 deletions modules/binding-infra-node-workloads-using-taints-tolerations.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,26 @@ For example:
$ oc adm taint nodes node1 node-role.kubernetes.io/infra:NoSchedule
----
+
[TIP]
====
You can alternatively apply the following YAML to add the taint:
[source,yaml]
----
kind: Node
apiVersion: v1
metadata:
name: <node_name>
labels:
...
spec:
taints:
- key: node-role.kubernetes.io/infra
effect: NoSchedule
...
----
====
+
This example places a taint on `node1` that has key `node-role.kubernetes.io/infra` and taint effect `NoSchedule`. Nodes with the `NoSchedule` effect schedule only pods that tolerate the taint, but allow existing pods to remain scheduled on the node.
+
[NOTE]
Expand All @@ -38,14 +58,14 @@ If a descheduler is used, pods violating node taints could be evicted from the c
+
[source, yaml]
----
tolerations:
tolerations:
- effect: NoSchedule <1>
key: node-role.kubernetes.io/infra <2>
operator: Exists <3>
----
<1> Specify the effect that you added to the node.
<2> Specify the key that you added to the node.
<3> Specify the `Exists` Operator to require a taint with the key `node-role.kubernetes.io/infra` to be present on the node.
<3> Specify the `Exists` Operator to require a taint with the key `node-role.kubernetes.io/infra` to be present on the node.
+
This toleration matches the taint created by the `oc adm taint` command. A pod with this toleration can be scheduled onto the infra node.
+
Expand Down
16 changes: 16 additions & 0 deletions modules/machineset-manually-scaling.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,20 @@ Or:
$ oc edit machineset <machineset> -n openshift-machine-api
----
+
[TIP]
====
You can alternatively apply the following YAML to scale the machine set:
[source,yaml]
----
apiVersion: machine.openshift.io/v1beta1
kind: MachineSet
metadata:
name: <machineset>
namespace: openshift-machine-api
spec:
replicas: 2
----
====
+
You can scale the machine set up or down. It takes several minutes for the new machines to be available.
32 changes: 32 additions & 0 deletions modules/machineset-modifying.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,22 @@ Or:
$ oc edit machineset <machineset> -n openshift-machine-api
----
+
[TIP]
====
You can alternatively apply the following YAML to scale the machine set:
[source,yaml]
----
apiVersion: machine.openshift.io/v1beta1
kind: MachineSet
metadata:
name: <machineset>
namespace: openshift-machine-api
spec:
replicas: 0
----
====
+
Wait for the machines to be removed.

. Scale up the machine set as needed:
Expand All @@ -60,4 +76,20 @@ Or:
$ oc edit machineset <machineset> -n openshift-machine-api
----
+
[TIP]
====
You can alternatively apply the following YAML to scale the machine set:
[source,yaml]
----
apiVersion: machine.openshift.io/v1beta1
kind: MachineSet
metadata:
name: <machineset>
namespace: openshift-machine-api
spec:
replicas: 2
----
====
+
Wait for the machines to start. The new machines contain changes you made to the machine set.
16 changes: 15 additions & 1 deletion modules/nodes-cluster-overcommit-node-enforcing.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,21 @@ metadata:
----
$ oc label machineconfigpool worker custom-kubelet=small-pods
----
+
[TIP]
====
You can alternatively apply the following YAML to add the label:
[source,yaml]
----
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineConfigPool
metadata:
labels:
custom-kubelet: small-pods
name: worker
----
====

.Procedure

Expand All @@ -75,4 +90,3 @@ spec:
<1> Assign a name to CR.
<2> Specify the label to apply the configuration change.
<3> Set the `cpuCfsQuota` parameter to `false`.

Loading

0 comments on commit 64e163c

Please sign in to comment.