Skip to content

Instantly share code, notes, and snippets.

@v1k0d3n
Last active August 19, 2023 16:04
Show Gist options
  • Save v1k0d3n/0505898e3c63bc2596b31953cbfbffdd to your computer and use it in GitHub Desktop.
Save v1k0d3n/0505898e3c63bc2596b31953cbfbffdd to your computer and use it in GitHub Desktop.
Defragging Etcd in OpenShift (if needed)

NOTE: These proceedures are only for OpenShift SNO-Deployments. I will create a loop command later for multi-node environments.

❯ oc get pods -n openshift-etcd | grep etcd
etcd-itamae                4/4     Running     20         8d

ETCD_SNO_ENDPOINT=$(oc get pods -n openshift-etcd | grep etcd | awk '{print $1}')
echo $ETCD_SNO_ENDPOINT
ETCD_SNO_ENDPOINT=$(oc get pods -n openshift-etcd | grep etcd | awk '{print $1}')

oc rsh  -n openshift-etcd $ETCD_SNO_ENDPOINT etcdctl endpoint status --cluster -w table
oc rsh  -n openshift-etcd $ETCD_SNO_ENDPOINT
unset ETCDCTL_ENDPOINTS
etcdctl --command-timeout=30s --endpoints=https://localhost:2379 defrag
etcdctl endpoint status -w table --cluster
etcdctl alarm list
etcdctl alarm disarm
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment