Controlplane $ kubectl get po blue -o yaml apiVersion: v1 kind: Pod metadata: . . .

Prakash Dhammikh:
controlplane $ kubectl get po blue -o yaml
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: “2021-05-29T01:43:28Z”
managedFields:

  • apiVersion: v1
    fieldsType: FieldsV1
    fieldsV1:
    f:spec:
    f:containers:
    k:{“name”:“navy”}:
    .: {}
    f:command: {}
    f:image: {}
    f:imagePullPolicy: {}
    f:name: {}
    f:resources: {}
    f:terminationMessagePath: {}
    f:terminationMessagePolicy: {}
    k:{“name”:“teal”}:
    .: {}

Mariusz Gomse:
it is normal that you have there e.g. managed fields to have a template for your “actual code” you need to:
kubectl get po po-name -o yaml > template.yaml and you can remove excessive fields (they are there because by get po -o yaml you are simply outputing whole pod data of the existing (working) object
• OR kubectl run po-name --image=image-name --dry-run=client -o yaml > template.yaml - in this case you won’t have so much excessive fields because object won’t be created in k8s at all

PR:
Actually when you do -o yaml and redirect to xxx.yaml just change the necessary fields in exam to save time if you dont remove also its not a problem