Skip to content

Instantly share code, notes, and snippets.

@KashifSaadat
Created January 24, 2018 12:45
Show Gist options
  • Save KashifSaadat/b7dcb1a284caaa6f61b6d5a118aaa08b to your computer and use it in GitHub Desktop.
Save KashifSaadat/b7dcb1a284caaa6f61b6d5a118aaa08b to your computer and use it in GitHub Desktop.
Supporting new AWS Availability Zones in kops - ETCD Config Updates
# Stop the kubelet & protokube services, preventing automatic updates to the etcd config or the containers from restarting
systemctl stop kubelet && systemctl stop protokube
# Terminate any running etcd containers
docker kill $(docker ps | grep "etcd" | awk '{print $1}')
# Update the etcd configurations, setting ETCD_INITIAL_CLUSTER_STATE to existing
sed -i -e "s/value\: new/value: existing/g" /etc/kubernetes/manifests/etcd.manifest
sed -i -e "s/value\: new/value: existing/g" /etc/kubernetes/manifests/etcd-events.manifest
# Grab the etcd main & events volume paths
ETCD_MAIN_VOL_PATH="`cat /etc/kubernetes/manifests/etcd.manifest | sed -n 's/^\s*path: \(\/mnt\/master-vol-[a-zA-Z0-9\/\-]*\)$/\1/p'`/member"
ETCD_EVENTS_VOL_PATH="`cat /etc/kubernetes/manifests/etcd-events.manifest | sed -n 's/^\s*path: \(\/mnt\/master-vol-[a-zA-Z0-9\/\-]*\)$/\1/p'`/member"
# Drop existing etcd data within these paths, they will replicate data from existing members in the cluster
rm -rf $ETCD_MAIN_VOL_PATH
rm -rf $ETCD_EVENTS_VOL_PATH
# Start the kubelet service up again
systemctl start kubelet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment