etcd v3 can't read encoded values etcd v3 can't read encoded values kubernetes kubernetes

etcd v3 can't read encoded values


A bit late to the show but here is how I was able to do that.Because in etcd pre-v3 the data was stored in plain json and since v3 it is in binary format the additional decode step is needed.

You may check this repo for details: https://github.com/jpbetz/auger

And here are Kubernetes docs regarding protobuf encoding

And the working example is:

etcdctl get "/registry/pods/default/nginx-dbddb74b8-62hh7" --prefix -w simple | auger decode

Now the response is plain-text:

apiVersion: v1kind: Podmetadata:  annotations:    kubernetes.io/limit-ranger: 'LimitRanger plugin set: cpu request for container      nginx'  creationTimestamp: 2019-08-12T14:11:57Z...


By default in kube 1.6 and up, values are stored in protobuf encoding, not JSON


kubernetes known issue:https://github.com/kubernetes/kubernetes/issues/44670

As mentioned in the issue,the openshift tool(https://github.com/openshift/origin/tree/master/tools/etcdhelper) could help read the value. It works for me, but it's really not convenient.