Last active
February 2, 2021 02:39
-
-
Save timroster/7eb49e14495347f5d5d5a7cbd5d959fd to your computer and use it in GitHub Desktop.
Short script to recover etcd on crc when it gets misconfigured
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# address CRC issues like: https://github.com/code-ready/crc/issues/1888 | |
# run this script from the crc vm - something like (switch to id_rsa on crc <= 1.20): | |
# scp -i ~/.crc/machines/crc/id_ecdsa fixcrc.sh [email protected]:fixcrc.sh | |
# ssh -i ~/.crc/machines/crc/id_ecdsa [email protected] "chmod +x ./fixcrc.sh ; sudo ./fixcrc.sh" | |
ETCD_POD_DIR=$(ls -rt /etc/kubernetes/static-pod-resources | grep etc | tail -1) | |
sed -i 's/192.168.130.11/192.168.126.11/g' /etc/kubernetes/manifests/etcd-pod.yaml | |
sed -i 's/192.168.130.11/192.168.126.11/g' /etc/kubernetes/static-pod-resources/$ETCD_POD_DIR/configmaps/etcd-pod/pod.yaml | |
sed -i 's/192.168.130.11/192.168.126.11/g' /etc/kubernetes/static-pod-resources/$ETCD_POD_DIR/etcd-pod.yaml | |
echo "restarting kubelet..." | |
systemctl restart kubelet | |
echo "loop for crc node to become ready..." | |
while KUBECONFIG=/opt/kubeconfig kubectl get nodes | grep --silent Ready ; [ $? -ne 0 ] ; do | |
echo "still not ready waiting 20 seconds" | |
sleep 20 | |
done | |
echo "crc node is coming back online, use 'crc status' to follow" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment