Raw

Prints raw cluster information

TL;DR

  • Get or List Raw Resources in a cluster as Yaml or Json

Print Raw Resource

Motivation

Inspecting or Debugging Resources.

The Kubernetes Resources stored in etcd by the apiserver have many more fields than are shown in the summarized views. Users can learn much more about a Resource by viewing the Raw Resource as Yaml or Json. The Raw Resource will contain:

  • fields specified by the user in the Resource Config (e.g. metadata.name)
  • metadata fields owned by the apiserver (e.g. metadata.creationTimestamp)
  • fields defaulted by the apiserver (e.g. spec..imagePullPolicy)
  • fields set by Controllers (e.g. spec.clusterIp, status)

Get

The kubectl get reads Resources from the cluster and formats them as output. The examples in this chapter will query for Resources by providing Get the Resource Type as an argument. For more query options see Queries and Options.

YAML

Print the Raw Resource formatting it as YAML.

  1. kubectl get deployments -o yaml
  1. apiVersion: v1
  2. items:
  3. - apiVersion: extensions/v1beta1
  4. kind: Deployment
  5. metadata:
  6. annotations:
  7. deployment.kubernetes.io/revision: "1"
  8. creationTimestamp: 2018-11-15T18:58:03Z
  9. generation: 1
  10. labels:
  11. app: nginx
  12. name: nginx
  13. namespace: default
  14. resourceVersion: "1672574"
  15. selfLink: /apis/extensions/v1beta1/namespaces/default/deployments/nginx
  16. uid: 6131547f-e908-11e8-9ff6-42010a8a00d1
  17. spec:
  18. progressDeadlineSeconds: 600
  19. replicas: 1
  20. revisionHistoryLimit: 10
  21. selector:
  22. matchLabels:
  23. app: nginx
  24. strategy:
  25. rollingUpdate:
  26. maxSurge: 25%
  27. maxUnavailable: 25%
  28. type: RollingUpdate
  29. template:
  30. metadata:
  31. creationTimestamp: null
  32. labels:
  33. app: nginx
  34. spec:
  35. containers:
  36. - image: nginx
  37. imagePullPolicy: Always
  38. name: nginx
  39. resources: {}
  40. terminationMessagePath: /dev/termination-log
  41. terminationMessagePolicy: File
  42. dnsPolicy: ClusterFirst
  43. restartPolicy: Always
  44. schedulerName: default-scheduler
  45. securityContext: {}
  46. terminationGracePeriodSeconds: 30
  47. status:
  48. availableReplicas: 1
  49. conditions:
  50. - lastTransitionTime: 2018-11-15T18:58:10Z
  51. lastUpdateTime: 2018-11-15T18:58:10Z
  52. message: Deployment has minimum availability.
  53. reason: MinimumReplicasAvailable
  54. status: "True"
  55. type: Available
  56. - lastTransitionTime: 2018-11-15T18:58:03Z
  57. lastUpdateTime: 2018-11-15T18:58:10Z
  58. message: ReplicaSet "nginx-78f5d695bd" has successfully progressed.
  59. reason: NewReplicaSetAvailable
  60. status: "True"
  61. type: Progressing
  62. observedGeneration: 1
  63. readyReplicas: 1
  64. replicas: 1
  65. updatedReplicas: 1
  66. kind: List
  67. metadata:
  68. resourceVersion: ""
  69. selfLink: ""

Command / Examples

One can also get the raw output as with JSON Check out the reference for commands and examples for get