Kubernetes Declarative Management and Manual Commands risks

12/15/2019

I understand the difference between Declarative and Imperative Management, well explained in this thread kubectl apply vs kubectl create? and in the official doc https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/

But my residual doubt is that even in the Declarative Management a (manual) command like

kubectl scale

although persists further

kubectl apply

commands still "won't survive" a cluster restart (since its configuration change is stored in the cluster store, like etcd), right? If so, shouldn't we make changes only to the

object configuration file

and redeploy through

kubectl apply

command? thanks

-- toto'
kubernetes

1 Answer

12/15/2019

As far as I understand kubectl scale will change the ReplicaSet configuration object in etcd. So, it'll survive a restart.

However, you should store your configuration objects in a version control system (git). If you execute commands like kubectl scale, that won't update the copies stored in git. The next usage of those configuration files will override the values previously set.

-- Dávid Molnár
Source: StackOverflow