what does {} in containers section in kubernetes mean?

I want to know what resources: {} in pod.spec.containers.resources in Kubernetes means?

You can get documentation using kubectl for the fields of Kubernetes resources. For example:

$ kubectl explain pod.spec.containers.resources
KIND:       Pod
VERSION:    v1

FIELD: resources <ResourceRequirements>

DESCRIPTION:
    Compute Resources required by this container. Cannot be updated. More info:
    https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
    ResourceRequirements describes the compute resource requirements.

FIELDS:
  claims    <[]ResourceClaim>
    Claims lists the names of resources, defined in spec.resourceClaims, that
    are used by this container.

    This is an alpha field and requires enabling the DynamicResourceAllocation
    feature gate.

    This field is immutable. It can only be set for containers.

  limits    <map[string]Quantity>
    Limits describes the maximum amount of compute resources allowed. More info:
    https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/

  requests  <map[string]Quantity>
    Requests describes the minimum amount of compute resources required. If
    Requests is omitted for a container, it defaults to Limits if that is
    explicitly specified, otherwise to an implementation-defined value. Requests
    cannot exceed Limits. More info:
    https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/

If you need more information about any of the subfields, just append that field to the command

$ kubectl explain pod.spec.containers.resources.claims
$ kubectl explain pod.spec.containers.resources.limits
$ kubectl explain pod.spec.containers.resources.requests
...

In your case, the {} means that none of the fields are set.

Answered By: Andy Dalton
Categories: Answers Tags:
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.