Why doesn't the kubernetes documentation show the valid mappings for requests or capacity?

7/8/2021

In kubernetes the correct syntax for specifying the storage requirement of a persistentVolume is:

spec:
  capacity:
    storage: 10Gi

when inspecting the documentation reference or using kubectl explain I would expect to see the storage key noted in the docs however it's absent, it's not clear from the documentation which mappings are allowed inside the capacity section of a persistentVolume spec and how to know that "storage" is the correct key to denote the disk requirement of the persistent volume.

~ kubectl explain --recursive persistentvolume.spec.capacity

FIELDS:
  .
  .
   capacity	<map[string]string>
  .
  .

You can see examples of course but that doesn't tell me what other possible keys there are, just what there is in the example.

In a similar vein, I can see from this table tucked away in the docs that allowed keys inside resources.requests are: [cpu, memory, hugepages-<size>] but if I call kubectl explain --recursive pod.spec.resources I would expect to see:

FIELDS:
   limits	<map[string]string>
     cpu
     memory
     hugepages-<size>
   requests	<map[string]string>
     cpu
     memory
     hugepages-<size>

but instead you see just:

FIELDS:
   limits	<map[string]string>
   requests	<map[string]string>

Whilst the datatype make it clears that limits and requests are both mappings the docs don't make it easy to find out what the valid mappings are.

For these mapping, other than finding examples, how do I know what all the possible valid mappings are, and how come they don't appear in the kubectl explain output

-- Dave McLean
kubectl
kubernetes
persistent-volumes

1 Answer

7/13/2021

There are many possible explanations, but most probable are:

  • it just wasn't updated,
  • design choice.

Remember, docs are written by people, not generated. When things are getting updated, certain changes may not be properly described.

-- p10l
Source: StackOverflow