mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-05 21:46:22 +01:00
64 lines
2.2 KiB
Plaintext
64 lines
2.2 KiB
Plaintext
// Module included in the following assemblies:
|
|
//
|
|
// * windows_containers/scheduling-windows-workloads.adoc
|
|
|
|
:_content-type: PROCEDURE
|
|
[id="creating-runtimeclass_{context}"]
|
|
= Creating a RuntimeClass object to encapsulate scheduling mechanisms
|
|
|
|
Using a `RuntimeClass` object simplifies the use of scheduling mechanisms like taints and tolerations; you deploy a runtime class that encapsulates your taints and tolerations and then apply it to your pods to schedule them to the appropriate node. Creating a runtime class is also necessary in clusters that support multiple operating system variants.
|
|
|
|
.Procedure
|
|
|
|
. Create a `RuntimeClass` object YAML file. For example, `runtime-class.yaml`:
|
|
+
|
|
[source,yaml]
|
|
----
|
|
apiVersion: node.k8s.io/v1beta1
|
|
kind: RuntimeClass
|
|
metadata:
|
|
name: <runtime_class_name> <1>
|
|
handler: 'runhcs-wcow-process'
|
|
scheduling:
|
|
nodeSelector: <2>
|
|
kubernetes.io/os: 'windows'
|
|
kubernetes.io/arch: 'amd64'
|
|
node.kubernetes.io/windows-build: '10.0.17763'
|
|
tolerations: <3>
|
|
- effect: NoSchedule
|
|
key: os
|
|
operator: Equal
|
|
value: "Windows"
|
|
----
|
|
<1> Specify the `RuntimeClass` object name, which is defined in the pods you want to be managed by this runtime class.
|
|
<2> Specify labels that must be present on nodes that support this runtime class. Pods using this runtime class can only be scheduled to a node matched by this selector. The node selector of the runtime class is merged with the existing node selector of the pod. Any conflicts prevent the pod from being scheduled to the node.
|
|
<3> Specify tolerations to append to pods, excluding duplicates, running with this runtime class during admission. This combines the set of nodes tolerated by the pod and the runtime class.
|
|
|
|
. Create the `RuntimeClass` object:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc create -f <file-name>.yaml
|
|
----
|
|
+
|
|
For example:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc create -f runtime-class.yaml
|
|
----
|
|
|
|
. Apply the `RuntimeClass` object to your pod to ensure it is scheduled to the appropriate operating system variant:
|
|
+
|
|
[source,yaml]
|
|
----
|
|
apiVersion: v1
|
|
kind: Pod
|
|
metadata:
|
|
name: my-windows-pod
|
|
spec:
|
|
runtimeClassName: <runtime_class_name> <1>
|
|
...
|
|
----
|
|
<1> Specify the runtime class to manage the scheduling of your pod.
|