resource deployments/my-app missing the kubectl.kubernetes.io/last-applied-configuration annotation which is required by kubectl
the warning happens because it’s the first time you are creating the resource. therefore there is no annotation you’re kubectl can use to figure out what to patch and change on the client side.
you’ll always get the warning locally unless you either get the currently rendered manifest from k8s with the correct annotation from the api, change it and reapply it, or add an empty annotation yourself to your manifest.
like this for example:
annotations:
kubectl.kubernetes.io/last-applied-configuration: ""
another solution would be to not use client-side apply but have k8s apply the manifest server-side. so you do not need the annotation yourself. which is recommended as of late anyways.
so you would use kubectl apply -f $yourmanifest.yaml --server-side
for more information on server-side apply you can check the documentation here
Read more here: Source link
