创建calico网络报错client response is invalid json

使用docker创建calico网络失败。

# docker network create --driver calico --ipam-driver calico-ipam testcalico
Error 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.

查看docker日志:

# journalctl -fu docker
-- Logs begin at Sun 2018-05-06 10:42:10 CST. --
May 06 10: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."
May 06 10: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."
May 06 10: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."
May 06 10:51:13 gpu16 dockerd[1045]: time="2018-05-06T10:51:13.213320054+08:00" level=error msg="discovery error: Unexpected watch error"

首先想到的错误原因可能是:calico网络后台的分布式存储是etcd,而环境中使用的V3版本的etcd,而该版本在API方面既支持V2又支持V3。docker中未正确配置需要的版本,即docker要求使用的etcd API版本和etcd提供的API版本不一致,导致出现该问题。

验证:命令行手动去获取etcd的版本号:curl http://

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

返回正常。

看到http,忽然想到我们的环境访问http和https是需要设置代理http_proxy和https_proxy,同样,也需要设置no_proxy来过滤不使用代理的IP。如果要访问的IP不在no_proxy的范围内,代理就会返回非法的http应答,而这个应答不是json格式的,很可能就对应了错误日志中的“response is invalid json”部分。在环境变量中,已经设置了http_proxy,https_proxy和no_proxy,但是,docker不能使用操作系统的这三个环境变量,我们需要配置docker的这三个环境变量。而且,在创建calico网络时,docker会通过http请求向etcd注册,因此在no_proxy中需要包含etcd集群的IP

# 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

待docker服务重启完毕,再尝试创建calico网络,成功。

# docker network create --driver calico --ipam-driver calico-ipam testcalico
53cbe9b82451b017be6d5d80a8fc17e320f6269521dfeabb7e07fd79ee92e3ef

原文地址:https://www.cnblogs.com/styshoo/p/8998339.html

时间: 2024-08-27 13:31:50

创建calico网络报错client response is invalid json的相关文章

创建maven项目报错

我在自己的电脑上装了一个MyEclipse6.5 和spring tools suit 3.5.1  因为sts自带了maven插件,所以只要在 preference里面配置下maven的本地路径和settings文件的本地路径就可以了, 配置完了之后 我在MyEclipse和sts里面都导入了maven项目 都可以运行,我就觉得maven配置好了,但是我在sts里面创建maven项目的时候报错 Could not calculate build plan: Plugin org.apache.

opennebula kvm 创建VM oned报错日志

Thu Jul 17 10:45:36 2014 [ReM][D]: Req:4720 UID:0 VirtualMachineDeploy result SUCCESS, 12 Thu Jul 17 10:45:40 2014 [TM][D]: Message received: LOG I 12 Command execution fail: /app/opennebula/var/remotes/tm/shared/clone localhost.localdomain:/app/open

Django:创建用户模型报错: (admin.E108) The value of 'list_display[4]'解决方案

参考资料:虫师-<web接口开发与自动化测试:基于python语言> 日常学习Django框架中,创建了用户模型,但是页面功能验证时候,提示不能进行列表字段操作,debug好久,才找到问题原因,心累... 下面是大概过程和解决方案... models.py文件代码: 1 from django.db import models 2 3 # Create your models here. 4 # 发布会表 5 class Event(models.Model): 6 name = models

前端ajax用post方式提交json数据给后端时,网络报错 415

项目框架:spring+springmvc+mybatis 问题描述:前端ajax用post方式提交json数据给后端时,网络报错 415 前端异常信息:Failed to load resource: the server responded with a status of 415 (Unsupported Media Type) 后端异常信息:无 报错原因:缺少jackson包 类似问题注意点: springmvc添加配置.注解: pom.xml添加jackson包引用: Ajax请求时没

docker pull / docker login 报错 Error response from daemon: Get https://registry-1.docker.io/v2/: x509

docker pull 和 docker login 的时候报错 Error response from daemon: Get https://registry-1.docker.io/v2/: x509: certificate is valid for bw-production.space, brickworksoftware.com, *.bw-production.space, *.brickworksoftware.com, not registry-1.docker.io 从报错

IDEA创建maven项目报错解决:Failed to create a Maven project: &#39;C:/Users/../IdeaProjects/../pom.xml&#39; already e

晚上用IDEA创建Java的maven项目时报错了: Failed to create a Maven project: 'C:/Users/../IdeaProjects/../pom.xml' already exists in VFS1这个错误是因为之前我已经在这个文件夹里创建过同名的maven项目. 解决方法如下: 先把这个项目删了,然后把回收站中的这个项目和之前同名的项目一起彻底删除,重新创建一遍就不会报错了 IDEA创建maven项目报错解决:Failed to create a M

报错:struts之invalid field value for field

在表单中输入数据提交时提示invalid field value for field "product.sale Date".(product.sale是文本框的名字,Date是其数据类型) 原因:输入数据的格式错误. 希望:将提示改为,如:"格式错误,请输入正确的格式". 方法:使用国际资源, PS:国际资源使用方法 http://www.cnblogs.com/yexiaodong/p/3702765.html 报错:struts之invalid field v

IDEA连接mysql又报错!Server returns invalid timezone. Go to &#39;Advanced&#39; tab and set &#39;serverTimezone&#39; prope

错误界面 IDEA连接mysql,地址,用户名,密码,数据库名,全都配置好了,点测试连接,咔!不成功! 界面是这样的, 翻译过来就是:服务器返回无效时区.进入“高级”选项卡,手动设置“serverTimezone”属性. 看起来是时区出了问题.时区怎么会出问题?坑真多.网上搜了各种解决办法,琳琅满目,复杂的简单的,总算是解决了! 解决方案我的问题出在两块,第一,设置mysql的时区.第二,mysql驱动的版本.详细步骤如下: 第一,设置mysql时区.1,我们先来检查下mysql时区. 配置完环

mysql导入文件报错:[Err] 1067 - Invalid default value for &#39;active_time&#39;

报错原因意思是说:mysql5.7版本中有了一个STRICT mode(严格模式),而在此模式下默认是不允许设置日期的值为全0值的,所以想要  解决这个问题,就需要修改sql_mode的值. 修改全局设置 mysql> set @@global.sql_mode=(select replace(@@global.sql_mode,'NO_ZERO_IN_DATE,NO_ZERO_DATE','')); mysql> select @@global.sql_mode; mysql导入文件报错:[