Skip to content

Latest commit

 

History

History
49 lines (34 loc) · 1.39 KB

ETCD_DATA_EXTRACTION.md

File metadata and controls

49 lines (34 loc) · 1.39 KB

Extracting data from etcd

This has an explanation of some of the keys in the datastore.

  1. Create a kind cluster
kind create cluster

Or with a custom config (to use eckd)

kind create cluster --config kind-config.yaml
  1. Extract api server client certificates and etcd ca cert
docker cp kind-control-plane:/etc/kubernetes/pki pki

Use the v3 api:

export ETCDCTL_API=3

To list all the keys in etcd:

etcdctl --endpoints https://172.19.0.2:2379 --cert pki/apiserver-etcd-client.crt --key pki/apiserver-etcd-client.key --cacert pki/etcd/ca.crt get / --prefix --keys-only

To get a single key with its data in etcd:

etcdctl --endpoints https://172.19.0.2:2379 --cert pki/apiserver-etcd-client.crt --key pki/apiserver-etcd-client.key --cacert pki/etcd/ca.crt get <key-name>

Etcd data seems to be some sort of protobuf format with the majority of the data in normal bytes.

According to their reference data is stored in that protobuf format. It should be ok to deserialise an object into Unknown type, check the typeMeta.kind and then further deserialise the raw data if the kind is known as a core one, alternatively it may be json so can also use that as a more general one.