raw

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

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: ""

JSON

Print the Raw Resource formatting it as JSON.

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