etcd v3 API unavailable

2/20/2019

I'm trying to deploy CoreDNS with etcd as the backend. I've gotten through most of the configuration of both etcd and CoreDNS, but I'm trying to document for the developers how to push records into etcd for CoreDNS.

Reading all of the etcd v3 documentation, there was a change from the v2 API in etcd v2 to v3 API in etcd v3. There are multiple pages that refer to API calls being made using URLs such as:

curl -L http://localhost:2379/v3beta/kv/put \
  -X POST -d '{"key": "Zm9v", "value": "YmFy"}'

I've tried multiple combinations of the http://IP:2379/[v3alpha | v3beta | v3]/kv/put and I always get a not found or 404 not found.

This works fine:

curl http://IPADDRESS:2379/v2/keys/test/local/test -XPUT -d '{"host":"IPADDRESS","ttl":60}'

But this doesn't:

curl http://IPADDRESS:2379/[v3alpha | v3beta | v3]/keys/test/local/test -XPUT -d '{"host":"IPADDRESS","ttl":60}'

Is there something I'm missing from the documentation?

I'm running etcd v 3.3.12.

-- natediggs
coredns
etcd
kubernetes

1 Answer

6/28/2019

After checked the etcd source codes, I finally have found the RC of this issue. In etcd 3.3.0, the default value of the config flag "enable-grpc-gateway" is false if the etcd loads config from the yaml config file, but the default value is true if etcd loads config flag from commandline. so add below lines to your etcd config file can solve the issue.

enable-grpc-gateway: true

I tried the etcd 3.3.13, it's fixed in this version.

-- Jian Zhang
Source: StackOverflow