There are two steps required to use opaque integer resources. First, the cluster operator must name and advertise a per-node opaque resource on one or more nodes. Second, application developer must request the opaque resource in pods.
To make opaque integer resources available:
-
Allocate the resource and assign a name starting with
pod.alpha.kubernetes.io/opaque-int-resource-
-
Advertise a new opaque integer resource by submitting a PATCH HTTP request to the API server that specifies the available quantity in the
status.capacity
for a node in the cluster.For example, the following HTTP request advertises five
foo
resources on theopenshift-node-1
node.PATCH /api/v1/nodes/openshift-node-1/status HTTP/1.1 Accept: application/json Content-Type: application/json-patch+json Host: openshift-master:8080 [ { "op": "add", "path": "/status/capacity/pod.alpha.kubernetes.io~1opaque-int-resource-foo", "value": "5" } ]
NoteThe
~1
in thepath
is the encoding for the character/
. The operation path value in the JSON-Patch is interpreted as a JSON-Pointer. For more details, refer to IETF RFC 6901, section 3.After this operation, the node
status.capacity
includes a new resource. Thestatus.allocatable
field is updated automatically with the new resource asynchronously.NoteSince the scheduler uses the node
status.allocatable
value when evaluating pod fitness, there might be a short delay between patching the node capacity with a new resource and the first pod that requests the resource to be scheduled on that node.