There are many ways to handle this.
First, use Deployment instead of "naked" Pods that are not managed. The Deployment will create new Pods for you, when the Pod template is changed.
Second, to manage Secrets may be a bit tricky. It would be great if you can use a setup where you can use Kustomize SecretGenerator - then each new Secret
will get its unique name. In addition, that unique name is reflected to the Deployment
automatically - and your pods will automatically be recreated when a Secret
is changed - this match your origin problem. When Secret
and Deployment
is handled this way, you apply the changes with:
kubectl apply -k <folder>