Container Resources

出自ChevyneWiki
於 2021年1月29日 (五) 02:33 由 Chevyne留言 | 貢獻 所做的修訂 (建立內容為「* '''cpu''' : One cpu, in Kubernetes, is equivalent to 1 vCPU/Core for cloud providers and 1 hyperthread on bare-metal Intel processors. : default quota period is…」的新頁面)
(差異) ←上個修訂 | 最新修訂 (差異) | 下個修訂→ (差異)
跳至導覽 跳至搜尋
  • cpu
One cpu, in Kubernetes, is equivalent to 1 vCPU/Core for cloud providers and 1 hyperthread on bare-metal Intel processors.
default quota period is 100ms.
minimum resolution of CPU quota is 1ms.
example: 0.1 = 100m
  • memory
Limits and requests for memory are measured in bytes.
express memory as a plain integer or as a fixed-point number using suffixes: E, P, T, G, M, K, or the power-of-two equivalents: Ei, Pi, Ti, Gi, Mi, Ki.
example: 128974848 = 129e6 = 129M = 123Mi
  • ephemeral-storage
local ephemeral storage, backed by locally-attached writeable devices or, sometimes, by RAM.
  • Here's an example.
apiVersion: v1
kind: Pod
metadata:
  name: frontend
spec:
  containers:
  - name: app
    image: images.my-company.example/app:v4
    resources:
      requests:
        cpu: "250m"
        memory: "64Mi"
        ephemeral-storage: "2Gi"
      limits:
        cpu: "500m"
        memory: "128Mi"
        ephemeral-storage: "4Gi"

  • Extended resources
non-Kubernetes-built-in resources.
Example:
{
  "kind": "Policy",
  "apiVersion": "v1",
  "extenders": [
    {
      "urlPrefix":"<extender-endpoint>",
      "bindVerb": "bind",
      "managedResources": [
        {
          "name": "example.com/foo",
          "ignoredByScheduler": true
        }
      ]
    }
  ]
}
apiVersion: v1
kind: Pod
metadata:
  name: my-pod
spec:
  containers:
  - name: my-container
    image: myimage
    resources:
      requests:
        cpu: 2
        example.com/foo: 1
      limits:
        example.com/foo: 1