Peter Lee:
• Hi all, is there a way /or kubectl command to see the list of yaml structure so which attributes can be avail in each parent element? for example, want to see full all possible attributes under resources parent element (resource in this case). spec.containers[].resources.limits.cpu
• spec.containers[].resources.limits.memory
• spec.containers[].resources.limits.hugepages-<size>
• spec.containers[].resources.requests.cpu
• spec.containers[].resources.requests.memory
• spec.containers[].resources.requests.hugepages-<size>
Ravi Shanker:
I was thinking on similar lines. Its too time consuming to read the json path from the kubectl commands as at times the files is quite large to process it fast for the exam.
Hinodeya:
@Peter Lee try this command and grep what you need kubectl explain pods --recursive | grep “keyworkd” -A 10
Peter Lee:
@Hinodeya, thanks for your response but there should be a better way to see the structure. anyone? or can be on the <https://kubernetes.io/docs|web page> (not kubeclt command)
root@controlplane:~# kubectl explain pods --recursive | grep resources -A 10
resources <Object>
limits <map[string]string>
requests <map[string]string>
securityContext <Object>
allowPrivilegeEscalation <boolean>
capabilities <Object>
add <[]string>
drop <[]string>
privileged <boolean>
procMount <string>
readOnlyRootFilesystem <boolean>
resources <Object>
limits <map[string]string>
requests <map[string]string>
securityContext <Object>
allowPrivilegeEscalation <boolean>
capabilities <Object>
add <[]string>
drop <[]string>
privileged <boolean>
procMount <string>
readOnlyRootFilesystem <boolean>
Peter Lee:
@Malayamanas Panda, thanks for your inputs. I am aware of that. is there any other way to see the structure?
Malayamanas Panda:
@Peter Lee This is swagger json file , but huge in size .
https://github.com/kubernetes/kubernetes/blob/master/api/openapi-spec/swagger.json
Import https://raw.githubusercontent.com/kubernetes/kubernetes/master/api/openapi-spec/swagger.json
into https://editor.swagger.io/
Wait for approximately 5 minutes, as the browser would be unresponsive.
Then you have all information from swagger-ui.