When I try to extract the pod yaml on KodeKloud lab, I see additional `managedFl . . .

Naveen Singh:
When I try to extract the pod yaml on KodeKloud lab, I see additional managedFlieds .

controlplane $ kubectl get pod ubuntu-sleeper -o yaml > ub.yaml
controlplane $ cat ub.yaml 

Ouput :

apiVersion: v1
kind: Pod
metadata:
  annotations:
    <http://kubectl.kubernetes.io/last-applied-configuration|kubectl.kubernetes.io/last-applied-configuration>: |
      {"apiVersion":"v1","kind":"Pod","metadata":{"annotations":{},"name":"ubuntu-sleeper","namespace":"default"},"spec":{"containers":[{"command":["sleep","4800"],"image":"ubuntu","name":"ubuntu-sleeper"}],"securityContext":{"runAsUser":1010}}}
  creationTimestamp: "2021-06-16T16:32:01Z"
  managedFields:
  - apiVersion: v1
    fieldsType: FieldsV1
    fieldsV1:
      f:metadata:
        f:annotations:
          .: {}
          f:<http://kubectl.kubernetes.io/last-applied-configuration|kubectl.kubernetes.io/last-applied-configuration>: {}
      f:spec:
        f:containers:
          k:{"name":"ubuntu-sleeper"}:
            .: {}
            f:command: {}
            f:image: {}
            f:imagePullPolicy: {}
            f:name: {}
            f:resources: {}
            f:terminationMessagePath: {}
            f:terminationMessagePolicy: {}
        f:dnsPolicy: {}
        f:enableServiceLinks: {}
        f:restartPolicy: {}
        f:schedulerName: {}
        f:securityContext:................................................

This field not there when I try on my local system.
What does that mean?

Mohamed Ayman:
These additional fields in the new version of Kubernetes.
You can only exclude some of these fields using grep command to decrease the file:

kubectl get pod nginx -o yaml | grep -v “f:” > pod.yaml

Satyam Sareen:
To get those fields in your local system, add --show-managed-fields