Hi. After executing command ``` kubectl get pod podname -o yaml > name-pod. . .

Evgeny Zayats:
Hi. After executing command

kubectl get pod podname -o yaml  > name-pod.yaml

I got unusual file with strange information. For example

managedFields:
  - apiVersion: v1
    fieldsType: FieldsV1
    fieldsV1:
      f:spec:
        f:containers:
          k:{"name":"ubuntu"}:
            .: {}
            f:command: {}
            f:image: {}
            f:imagePullPolicy: {}
            f:name: {}
            f:resources: {}
            f:terminationMessagePath: {}
            f:terminationMessagePolicy: {}
        f:dnsPolicy: {}
        f:enableServiceLinks: {}
        f:restartPolicy: {}
        f:schedulerName: {}
        f:securityContext: {}
        f:terminationGracePeriodSeconds: {}
    manager: python-requests
    operation: Update
    time: "2021-02-19T07:23:18Z"
  - apiVersion: v1
    fieldsType: FieldsV1
    fieldsV1:
      f:status:
        f:conditions:
          k:{"type":"ContainersReady"}:
            .: {}
            f:lastProbeTime: {}
            f:lastTransitionTime: {}
            f:status: {}
            f:type: {}
          k:{"type":"Initialized"}:
            .: {}
            f:lastProbeTime: {}
            f:lastTransitionTime: {}
            f:status: {}
            f:type: {}
......

How I can fix it?

Tej_Singh_Rana:
Hello, @Evgeny Zayats
You can only exclude these fields using grep command while saving into new file:
kubectl get pod nginx -o yaml | grep -v "f:" > newFile.yaml

Evgeny Zayats:
Thank you. But why I started to get this info in yaml files? Few days ago all was good

Tej_Singh_Rana:
in our labs?

Evgeny Zayats:
I mean, it in labs from https://kodekloud.com/.

Evgeny Zayats:
yes

Evgeny Zayats:
Can i share link with you?

Tej_Singh_Rana:
Please share it because I am seeing these fields from v1.18.

Evgeny Zayats:
https://kodekloud.com/courses/kubernetes-certification-course-labs/lectures/12039462

Tej_Singh_Rana:
someone has a same issue, got proper response on it. Please check.
https://kodekloud.com/community/t/cka-course-o-yaml-outputs-unwanted-fields-but-in-solution-video-the-output-doesnt-contain-these-fields/11902/5

Evgeny Zayats:
Thank you. But it’s strange, I didn’t get managedFields: fields few days ago.

Tej_Singh_Rana:
Are you sure? you ran the exact command described in the post?

Evgeny Zayats:
Yes, I’m sure. What “extract” command do you mean?

Tej_Singh_Rana:
I wrote exact not extract ?

Tej_Singh_Rana:
Something like:

kubectl run nginx --image=nginx -oyaml --dry-run=client > pod.yaml

Tej_Singh_Rana:
But please remember in v1.18+, you will get those manageFields for sure.

Shwetha Shenoy Vandse:
I have been seeing those fields in the yaml outputs since i started doing the labs.

Its finally fixed here.