Created
April 5, 2023 23:46
-
-
Save loperd/1851a5ba2d332d89d81511b10f8e505b to your computer and use it in GitHub Desktop.
Etcd remover
This file contains 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/bash | |
KEY="$1" | |
if [ -z "$KEY" ]; then | |
echo "Nothing to remove" | |
exit | |
fi | |
sudo etcdctl \ | |
--endpoints=https://localhost:2379 \ | |
--cacert=/etc/kubernetes/pki/etcd/ca.crt \ | |
--cert=/etc/kubernetes/pki/etcd/healthcheck-client.crt \ | |
--key=/etc/kubernetes/pki/etcd/healthcheck-client.key get / --prefix --keys-only | grep "${KEY}" \ | |
| xargs -n 1 sudo etcdctl \ | |
--endpoints=https://localhost:2379 \ | |
--cacert=/etc/kubernetes/pki/etcd/ca.crt \ | |
--cert=/etc/kubernetes/pki/etcd/healthcheck-client.crt \ | |
--key=/etc/kubernetes/pki/etcd/healthcheck-client.key \ | |
del |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment