The apply command takes into consideration the local configuration file, a live object definition on Kubernetes, and the last applied configuration before making a decision on what changes are to be made. This is the live configuration of the object on the Kubernetes cluster. This is how Kubernetes internally are stores information about an object no matter what approach you use to create the object. The YAML version of the local object configuration file is converted to JSON format, and it is then stored as the last applied configuration going forward for any updates to the object.
kubectl apply -f nginx-pod.yaml
Local file(YAML) – Live Object configuration(YAML) – Last applied Configuration(JSON).
https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/
- The local file(YAML) is stored on our local system.
- The live object configuration(YAML) is in the Kubernetes memory.
- The last applied Configuration(JSON) is in the The live object configuration itself.