concept kubectl apply in category kubernetes

This is an excerpt from Manning's book GitOps and Kuberentes.
: There are two basic ways to deploy Kubernetes: Imperatively using many
kubectlcommands or declaratively by writing manifests and usingkubectl apply. The former is useful for learning and interactive experimentation. The latter is best for reproducible deployments and tracking changes.
We can use the semi-magical
kubectl applycommand to create thenginx-declarativedeployment.$ kubectl apply -f declarative-deployment.yaml deployment.apps/nginx-declarative created $ kubectl get deployments NAME READY UP-TO-DATE AVAILABLE AGE nginx-declarative 3/3 3 3 5m29s nginx-imperative 3/3 3 3 24mThe
kubectl applycommand will do a create operation if thenginx-declarativeobject does not exist or an update if it already exists.Now, as with the imperative example, what if we want to change the value of the
organizationannotation fromsalestomarketing? Let’s edit thedeclarative-deployment.yamlfile. But before we runkubectl applyagain, let’s runkubectl diff.