Create Calico Network Error client response is invalid JSON

Source: Internet
Author: User
Tags etcd

Failed to create Calico network using Docker.

# docker network create --driver calico --ipam-driver calico-ipam testcalicoError response from daemon: failed to update store for object type *libnetwork.endpointCnt: client: response is invalid json. The endpoint is probably not valid etcd cluster endpoint.

To view Docker logs:

# Journalctl-fu Docker--Logs begin at Sun 2018-05-06 10:42:10 CST. -- May10:51:11 gpu16 dockerd[1045]: time="2018-05-06t10:51:11.997488908+08:00"Level=warning msg="Registering as\"192.168.56.16:2375\"In Discovery Failed:client:response is invalid JSON. The endpoint is probably not valid ETCD cluster endpoint. " May10:51:13 gpu16 dockerd[1045]: time="2018-05-06t10:51:13.209441579+08:00"Level=error msg="Discovery Error:client:response is invalid JSON. The endpoint is probably not valid ETCD cluster endpoint. " May10:51:13 gpu16 dockerd[1045]: time="2018-05-06t10:51:13.211323271+08:00"Level=error msg="Discovery Error:client:response is invalid JSON. The endpoint is probably not valid ETCD cluster endpoint. " May10:51:13 gpu16 dockerd[1045]: time="2018-05-06t10:51:13.213320054+08:00"Level=error msg="Discovery error:unexpected Watch Error"

The first reason to think of the error may be: Calico Network background distributed storage is ETCD, and the environment uses the V3 version of ETCD, and this version in the API support both V2 and support V3. The required version is not properly configured in Docker, which is the version of the ETCD API that Docker requires and the version of the API that ETCD provides is inconsistent, causing the problem.
Verify: The command line manually goes to get the version number of ETCD: Curl/HTTP

# curl http://192.168.56.96:2379/version{"etcdserver":"3.1.9","etcdcluster":"3.1.0"}

Return to normal.
See HTTP, suddenly think of our environment access to HTTP and HTTPS is required to set proxy http_proxy and Https_proxy, also need to set No_proxy to filter not using proxy IP. If the IP to be accessed is not in the range of No_proxy, the proxy will return an illegal HTTP response, which is not in JSON format and probably corresponds to the "response is invalid JSON" section in the error log. In the environment variables, Http_proxy,https_proxy and no_proxy have been set up, but Docker cannot use these three environment variables of the operating system, and we need to configure these three environment variables for Docker. Also, when you create a calico network, Docker registers with the ETCD via an HTTP request, so you need to include the IP of the ETCD cluster in the No_proxy.

# mkdir -p /etc/systemd/system/docker.service.d/# vim /etc/systemd/system/docker.service.d/http-proxy.conf[Service]Environment="HTTP_PROXY=http://192.168.11.200:8080/""HTTPS_PROXY=https://192.168.11.200:8080/""NO_PROXY=192.168.56.109,192.168.56.96"# systemctl daemon-reload# systemctl restart docker

After the Docker service restarts, try creating the Calico network successfully.

# docker network create --driver calico --ipam-driver calico-ipam testcalico53cbe9b82451b017be6d5d80a8fc17e320f6269521dfeabb7e07fd79ee92e3ef

Create Calico Network Error client response is invalid JSON

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.