Last active
April 26, 2024 16:14
-
-
Save lalyos/aef94a4c23973eaee4a17bb26b6972a2 to your computer and use it in GitHub Desktop.
Revisions
-
lalyos revised this gist
Jul 30, 2018 . 1 changed file with 13 additions and 8 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -18,22 +18,27 @@ kubectl exec -it \ ``` ## Proxy to etcd Or if you have etcdctl installed on your host. You can run `etcdctl` command on your localhost. Copy certificate and key from container to localhost: ``` kubectl cp kube-system/etcd-minikube:/var/lib/localkube/certs/etcd/peer.key . kubectl cp kube-system/etcd-minikube:/var/lib/localkube/certs/etcd/peer.crt . ``` Set `ETCDCTL_` environment variables ``` export \ ETCDCTL_API=3 \ ETCDCTL_INSECURE_SKIP_TLS_VERIFY=true \ ETCDCTL_CERT=peer.crt \ ETCDCTL_KEY=peer.key ``` Start a proxy (in a separate terminal) to be able to connect to etcd on localhost: ``` kubectl port-forward -n kube-system etcd-minikube 2379:2379 ``` ``` etcdctl get --keys-only --prefix=true "/registry/namespaces/" -
lalyos revised this gist
Jul 30, 2018 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,4 @@ You can demostrate how kubernetes stores everything in etcd (v3): ## One-liner -
lalyos created this gist
Jul 30, 2018 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,39 @@ ## One-liner You can exec `etcdctl` rigth in the etc pod: ``` kubectl exec -it \ -n kube-system etcd-minikube \ -- sh -c 'ETCDCTL_CACERT=/var/lib/localkube/certs/etcd/ca.crt \ ETCDCTL_CERT=/var/lib/localkube/certs/etcd/peer.crt \ ETCDCTL_KEY=/var/lib/localkube/certs/etcd/peer.key \ ETCDCTL_API=3 \ etcdctl \ get \ --keys-only \ --prefix=true \ "/registry/namespaces/" ' ``` ## Proxy to etcd Or if you have etcdctl installed on your host. First start a proxy to be able to connect to etcd on localhost: ``` kubectl port-forward -n kube-system etcd-minikube 2379:2379 ``` copy certificate and key from container to localhost: ``` kubectl cp kube-system/etcd-minikube:/var/lib/localkube/certs/etcd/peer.key . kubectl cp kube-system/etcd-minikube:/var/lib/localkube/certs/etcd/peer.crt . ``` than ``` export ETCDCTL_API=3 ETCDCTL_INSECURE_SKIP_TLS_VERIFY=true ETCDCTL_CERT=peer.crt ETCDCTL_KEY=peer.key ``` ``` etcdctl get --keys-only --prefix=true "/registry/namespaces/" ```