@@ -28,10 +28,10 @@ server.
2828
2929Each container of a pod can optionally specify one or more of the following:
3030
31- * ` spec.container [].resources.limits.cpu `
32- * ` spec.container [].resources.limits.memory `
33- * ` spec.container [].resources.requests.cpu `
34- * ` spec.container [].resources.requests.memory ` .
31+ * ` spec.containers [].resources.limits.cpu `
32+ * ` spec.containers [].resources.limits.memory `
33+ * ` spec.containers [].resources.requests.cpu `
34+ * ` spec.containers [].resources.requests.memory ` .
3535
3636Specifying resource requests and/or limits is optional. In some clusters, unset limits or requests
3737may be replaced with default values when a pod is created or updated. The default value depends on
@@ -53,7 +53,7 @@ One cpu, in Kubernetes, is equivalent to:
5353- 1 Azure vCore
5454- 1 * Hyperthread* on a bare-metal Intel processor with Hyperthreading
5555
56- Fractional requests are allowed. A container with ` spec.container [].resources.requests.cpu ` of ` 0.5 ` will
56+ Fractional requests are allowed. A container with ` spec.containers [].resources.requests.cpu ` of ` 0.5 ` will
5757be guaranteed half as much CPU as one that asks for ` 1 ` . The expression ` 0.1 ` is equivalent to the expression
5858` 100m ` , which can be read as "one hundred millicpu" (some may say "one hundred millicores", and this is understood
5959to mean the same thing when talking about Kubernetes). A request with a decimal point, like ` 0.1 ` is converted to
@@ -121,17 +121,17 @@ runner (Docker or rkt).
121121
122122When using Docker:
123123
124- - The ` spec.container [].resources.requests.cpu` is converted to its core value (potentially fractional),
124+ - The ` spec.containers [].resources.requests.cpu` is converted to its core value (potentially fractional),
125125 and multiplied by 1024, and used as the value of the [`--cpu-shares`](
126126 https://docs.docker.com/reference/run/#runtime-constraints-on-resources) flag to the `docker run`
127127 command.
128- - The `spec.container [].resources.limits.cpu` is converted to its millicore value,
128+ - The `spec.containers [].resources.limits.cpu` is converted to its millicore value,
129129 multiplied by 100000, and then divided by 1000, and used as the value of the [`--cpu-quota`](
130130 https://docs.docker.com/reference/run/#runtime-constraints-on-resources) flag to the `docker run`
131131 command. The [`--cpu-period`] flag is set to 100000 which represents the default 100ms period
132132 for measuring quota usage. The kubelet enforces cpu limits if it was started with the
133133 [`--cpu-cfs-quota`] flag set to true. As of version 1.2, this flag will now default to true.
134- - The `spec.container [].resources.limits.memory` is converted to an integer, and used as the value
134+ - The `spec.containers [].resources.limits.memory` is converted to an integer, and used as the value
135135 of the [`--memory`](https://docs.docker.com/reference/run/#runtime-constraints-on-resources) flag
136136 to the `docker run` command.
137137
@@ -269,6 +269,91 @@ LastState: map[terminated:map[exitCode:137 reason:OOM Killed startedAt:2015-07-0
269269
270270We can see that this container was terminated because `reason:OOM Killed`, where *OOM* stands for Out Of Memory.
271271
272+ # # Opaque Integer Resources (Alpha Feature)
273+
274+ Kubernetes version 1.5 introduces Opaque integer resources. Opaque
275+ integer resources allow cluster operators to advertise new node-level
276+ resources that would be otherwise unknown to the system.
277+
278+ Users can consume these resources in pod specs just like CPU and memory.
279+ The scheduler takes care of the resource accounting so that no more than the
280+ available amount is simultaneously allocated to pods.
281+
282+ **Note:** Opaque integer resources are Alpha in Kubernetes version 1.5.
283+ Only resource accounting is implemented; node-level isolation is still
284+ under active development.
285+
286+ Opaque integer resources are resources that begin with the prefix
287+ ` pod.alpha.kubernetes.io/opaque-int-resource-` . The API server
288+ restricts quantities of these resources to whole numbers. Examples of
289+ _valid_ quantities are `3`, `3000m` and `3Ki`. Examples of _invalid_
290+ quantities are `0.5` and `1500m`.
291+
292+ There are two steps required to use opaque integer resources. First, the
293+ cluster operator must advertise a per-node opaque resource on one or more
294+ nodes. Second, users must request the opaque resource in pods.
295+
296+ To advertise a new opaque integer resource, the cluster operator should
297+ submit a `PATCH` HTTP request to the API server to specify the available
298+ quantity in the `status.capacity` for a node in the cluster. After this
299+ operation, the node's `status.capacity` will include a new resource. The
300+ ` status.allocatable` field is updated automatically with the new resource
301+ asychronously by the Kubelet. Note that since the scheduler uses the
302+ node `status.allocatable` value when evaluating pod fitness, there may
303+ be a short delay between patching the node capacity with a new resource and the
304+ first pod that requests the resource to be scheduled on that node.
305+
306+ **Example:**
307+
308+ The HTTP request below advertises 5 "foo" resources on node `k8s-node-1`.
309+
310+ _NOTE : ` ~1` is the encoding for the character `/` in the patch path.
311+ The operation path value in JSON-Patch is interpreted as a JSON-Pointer.
312+ For more details, please refer to
313+ [IETF RFC 6901, section 3](https://tools.ietf.org/html/rfc6901#section-3)._
314+
315+ ` ` ` http
316+ PATCH /api/v1/nodes/k8s-node-1/status HTTP/1.1
317+ Accept: application/json
318+ Content-Type: application/json-patch+json
319+ Host: k8s-master:8080
320+
321+ [
322+ {
323+ "op": "add",
324+ "path": "/status/capacity/pod.alpha.kubernetes.io~1opaque-int-resource-foo",
325+ "value": "5"
326+ }
327+ ]
328+ ` ` `
329+
330+ To consume opaque resources in pods, include the name of the opaque
331+ resource as a key in the the `spec.containers[].resources.requests` map.
332+
333+ The pod will be scheduled only if all of the resource requests are
334+ satisfied (including cpu, memory and any opaque resources.) The pod will
335+ remain in the `PENDING` state while the resource request cannot be met by any
336+ node.
337+
338+ **Example:**
339+
340+ The pod below requests 2 cpus and 1 "foo" (an opaque resource.)
341+
342+ ` ` ` yaml
343+ apiVersion: v1
344+ kind: Pod
345+ metadata:
346+ name: my-pod
347+ spec:
348+ containers:
349+ - name: my-container
350+ image: myimage
351+ resources:
352+ requests:
353+ cpu: 2
354+ pod.alpha.kubernetes.io/opaque-int-resource-foo: 1
355+ ` ` `
356+
272357# # Planned Improvements
273358
274359The current system only allows resource quantities to be specified on a container.
0 commit comments