Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

upgrade k8s without deleting etcd data #1038

Merged
merged 10 commits into from
Aug 6, 2018
Merged

Conversation

DongZhaoYu
Copy link
Member

The etcd data will not be deleted by default when clean the cluster. New configurations will applied to the live objects if the objects is restored by k8s when the cluster is started.

kubectl create configmap host-configuration --from-file=host-configuration/ --dry-run -o yaml | kubectl apply --overwrite=true -f -
Copy link
Contributor

@ydye ydye Aug 4, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What‘s effect of --dry-run here? And what's effect of --overwrite here?
If I remove --overwrite, what will happen? I know when we label the node with overwrite, if the key already exists, it will be overwritten.
But when applying some object, without the --overwrite, it still works. So I wanna know what's the purpose of --overwrite here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The --dry-run here is to let create command generate the configuration without executing it. Since we need to read config from host-configuration file, the apply command cannot support reading config from a file. So I leverage the create dry run to generate the config and then apply it to the object.

The --overwrite flag is to resolve the conflict when applying new configuration by overwriting the old config with the new one. If we don't enable overwrite here, when merge the new config with the live config, if conflicts occur, the apply will fail and kubectl will report an error. Here I enable --overwrite is to make sure the new config can be successfully applied to the live object in case the object has been restored by k8s.

@coveralls
Copy link

Coverage Status

Coverage decreased (-13.3%) to 51.84% when pulling de09718 on zhaoyu/k8s-upgrade into cff136d on master.

@DongZhaoYu DongZhaoYu merged commit 0629122 into master Aug 6, 2018
@xudifsd xudifsd deleted the zhaoyu/k8s-upgrade branch August 15, 2018 07:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants