Search code examples
kubernetesdevopscluster-computingkops

How to revert pending `kops` changes?


What I have done?

$ kops edit ig nodes  ## added some nodes by modifying min/max nodes parameters
$ ...                 ## did some other modifications
$ kops update cluster ## saw the pending changes before applying them to the cluster

In kops update cluster I saw some not desired changes and wanted to revert all of them and start over. But given that the pending changes live in a state file in S3, I was not able to revert such changes easily.

I realized I should have had an S3 versioning enabled to revert the changes quickly and easily, but I didn't have that, and needed another way of cancelling pending changes.

Do you know how to achieve that?

PS. I googled for "kops drop pending changes" and similar; I browsed kops manual page; I tried accessing kops from multiple accounts before I realized that the changes are shared via S3... Nothing helped.

UPDATE: See the https://kops.sigs.k8s.io/tutorial/working-with-instancegroups/, it says

To preview the change:

kops update cluster

...
Will modify resources:
 *awstasks.LaunchTemplate LaunchTemplate/mycluster.mydomain.com
   InstanceType t2.medium -> t2.large

Presuming you're happy with the change, go ahead and apply it: kops update cluster --yes

So - what I want to do is to revert the not-yet-applied changes if i'm not happy with them. Is there any way other than kops edit ig nodes and manually changing t2.large back to t2.medium, repeating that for all changes I want to revert?


Solution

  • As the production cluster recommendations states, storing the configuration in version control is recommended to avoid these scenarios.

    But given that you are already facing a challenge now ... It depends on what is introducing the change. If it is a change in your cluster config alone, reverting those changes would be the way to go.

    If the changes comes from a kOps upgrade, there is no real way of reverting. kOps should never be downgraded, and the changes it tries to do are there for good reasons.

    If you can share what the unwanted changes are, I may be able to determine how to revert them.