CoreOS - How to use the new token?

We have the following task. In our cluster, the URL has changed. Once we changed the configuration to reflect these changes, the URLs were not updated to 'discovery.etcd.io'. Therefore, our idea was to simply use the new token. This, however, does not work. The cluster is not registered in the new token on 'discovery.etcd.io'. We do not want to reinstall every time we change the URL or token. Is there a better way? Reinstalling works without problems.

#cloud-config hostname: server1 coreos: etcd2: # generate a new token for each unique cluster from https://discovery.etcd.io/new?size=3 discovery: https://discovery.etcd.io/<our token> # multi-region and multi-cloud deployments need to use $public_ipv4 advertise-client-urls: server1:2379 initial-advertise-peer-urls: server1:2380 # listen on the official ports listen-client-urls: server1:2379 listen-peer-urls: server1:2380 #fleet: # public-ip: server1 # metadata: region=eu-central-1 #update: # reboot-strategy: etcd-lock units: - name: etcd2.service command: start # - name: fleet.service # command: start ssh_authorized_keys: <our ssh keys> 
+5
source share
2 answers

You do not need to reinstall it again. The following process is useful for gradually getting a cluster, instead of having a huge cloud configuration file that is difficult to debug.

  • Stop etcd and all dependent services (e.g. flannel, fleet, etc. that depend on etcd2): systemctl stop etcd2

  • Delete the etcd data files from / var / lib / etcd 2 / * (or the path to ETCD_DATA_DIR)

  • Change the discovery marker in the cloud configuration file, which is stored in: / var / lib / coreos-install / user_data p>

  • Reboot

    .

+4
source

discovery.etcd.io used only for bootstrapping: you request a token for multiple hosts from https://discovery.etcd.io/new?size=3 , and you basically reserve this url to load three hosts.

After the cluster boots up, the nodes in the cluster now use their own local storage: your 3 nodes get to know each other through the discovery endpoint and now form a cluster that has this information, so they don’t need the discovery endpoint anymore.

So, if you use the β€œnew” token, your cluster will not actually use it because it is already loaded, because the nodes already form their own cluster. To load a new cluster, you need to delete local data on each node.

I would advise you to read the migration documentation if you have other data that needs to be moved to a new cluster.

The basic backup procedure is similar:

 etcdctl backup \ --data-dir /var/lib/etcd \ --backup-dir /tmp/etcd_backup 
+2
source

All Articles