0

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'
  • 1,325
  • 1
  • 17
  • 36
  • i also see some confusion around that - what recommendation you finally got ? It seems it is better to rely on version managment tools like git rather than leaving everything to the kubernetes - – Nag Feb 17 '20 at 07:25

1 Answers1

2

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
  • 10,673
  • 7
  • 30
  • 55