K8s YAML file format
In Kubernetes, you create YAML files to define your resources such as a Deployment, Service, ConfigMap, etc.
This post provides an overview of the format of these YAML files.
metadata
(Metadata)

spec
(Specification)

The attributes here will be specific to the resource. For example, a Deployment YAML will support different attributes from a Service YAML.
status
(Status)
The status
section is automatically added by K8s. You don’t need to write this section in your own YAML files.
You can view the status
section in YAML by running something like
kubectl get service nginx-deployment -o yaml
That command should output the status in YAML format:

K8s gets the resurce status info from etcd
.
K8s will constantly compare the desired state you specify in the spec
section to the actual state that it adds via the status
section. If the two don’t match, K8s will take action to match the actual state to the desired state.