Last active
April 13, 2020 17:39
-
-
Save noseka1/137e62f8502ae8cddce02fe64bc8215f to your computer and use it in GitHub Desktop.
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
# fetch etcd client credentials | |
FILES=' | |
/etc/kubernetes/static-pod-resources/configmaps/etcd-serving-ca/ca-bundle.crt | |
/etc/kubernetes/static-pod-resources/secrets/etcd-client/tls.crt | |
/etc/kubernetes/static-pod-resources/secrets/etcd-client/tls.key | |
' | |
APISERVER_POD=$(oc get pod --namespace openshift-kube-apiserver --selector apiserver=true --output jsonpath='{.items[0].metadata.name}') | |
for FILE in $FILES; do | |
oc cp openshift-kube-apiserver/$APISERVER_POD:$FILE $(basename $FILE) | |
done | |
# connect to etcd | |
etcdctl \ | |
--cacert ca-bundle.crt \ | |
--cert tls.crt \ | |
--key tls.key \ | |
--endpoints https://etcd.openshift-etcd.svc.cluster.local:2379 \ | |
member list -w table | |
# alternative way to connect to etcd | |
export ETCDCTL_ENDPOINTS=https://etcd.openshift-etcd.svc.cluster.local:2379 | |
export ETCDCTL_CACERT=ca-bundle.crt | |
export ETCDCTL_KEY=tls.key | |
export ETCDCTL_CERT=tls.crt | |
etcdctl member list -w table | |
# list all keys | |
etcdctl get --keys-only --prefix / | |
# get key value | |
etcdctl get /kubernetes.io/config.openshift.io/clusterversions/version | |
# get a json value and pretty-print it | |
etcdctl get /kubernetes.io/config.openshift.io/clusterversions/version | jq -R 'fromjson?' | |
# watch etcd updates | |
etcdctl watch --prefix / |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment