搭建docker+k8s踩过的坑
2024-10-20 16:48:23
问题一:
# yum install -y etcd kubernetes
Error: docker-ce-cli conflicts with :docker-1.13.-.gitb2f74b2.el7.centos.x86_64
Error: docker-ce conflicts with :docker-1.13.-.gitb2f74b2.el7.centos.x86_64
原因:
安装kubernetes之前已经安装了docker
解决方法:卸载docker服务
卸载docker:yum remove -y 'rpm -qa |grep docker'
删除容器镜像:rm -rf /var/lib/docker
再次安装kubernetes,安装成功,而且会自动安装docker
问题二:
2.1
# etcdctl mk /atomic.io/network/config '{"Network":"192.168.3.4/16"}'
Error: client: etcd cluster is unavailable or misconfigured; error #: dial tcp 127.0.0.1:: connect: connection refused; error #: dial tcp 127.0.0.1:: connect: connection refused
error #: dial tcp 127.0.0.1:: connect: connection refused
error #: dial tcp 127.0.0.1:: connect: connection refused
原因:
如果出现如上的错误,是因为ETCD_LISTEN_CLIENT_URLS参数没有配置http://127.0.0.1:2379而导致的
解决方法:
将 # /etc/etcd/etcd.conf 中的ETCD_LISTEN_CLIENT_URLS参数改为:
ETCD_LISTEN_CLIENT_URLS="http://127.0.0.1:2379" 2.2
# etcdctl mk /atomic.io/network/config '{"Network":"192.168.3.4/16"}'
Error: dial tcp 192.168.3.4:: connect: connection refused
原因:
ETCD_LISTEN_CLIENT_URLS参数没有配置本地ip “http://192.168.3.4:2379” 而导致的
解决方法:
将 # /etc/etcd/etcd.conf 中的ETCD_LISTEN_CLIENT_URLS参数改为:
ETCD_LISTEN_CLIENT_URLS="http://192.168.37.49:2379,http://127.0.0.1:2379"
问题三:启动docker服务失败
# systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
Drop-In: /usr/lib/systemd/system/docker.service.d
└─flannel.conf
Active: failed (Result: exit-code) since Tue -- :: CST; 4min 15s ago
Docs: http://docs.docker.com
Process: ExecStart=/usr/bin/dockerd-current --add-runtime docker-runc=/usr/libexec/docker/docker-runc-current --default-runtime=docker-runc --exec-opt native.cgroupdriver=systemd --userland-proxy-path=/usr/libexec/docker/docker-proxy-current --init-path=/usr/libexec/docker/docker-init-current --seccomp-profile=/etc/docker/seccomp.json $OPTIONS $DOCKER_STORAGE_OPTIONS $DOCKER_NETWORK_OPTIONS $ADD_REGISTRY $BLOCK_REGISTRY $INSECURE_REGISTRY $REGISTRIES (code=exited, status=/FAILURE)
Main PID: (code=exited, status=/FAILURE) Jun :: localhost.localdomain systemd[]: Starting Docker Application Container Engine...
Jun :: localhost.localdomain dockerd-current[]: unable to configure the Docker daemon with file /etc/docker/daemon.json: the following directives are specified both as a flag and in the configuration file:...rom file: )
Jun :: localhost.localdomain systemd[]: docker.service: main process exited, code=exited, status=/FAILURE
Jun :: localhost.localdomain systemd[]: Failed to start Docker Application Container Engine.
Jun :: localhost.localdomain systemd[]: Unit docker.service entered failed state.
Jun :: localhost.localdomain systemd[]: docker.service failed.
原因是:
安装kubernets之前安装过的docker残留文件影响了kubernets安装的docker启动
解决方法:
将/etc/docker/daemon.json删除,重新启动即可。
问题四:创建k8s管理mysql的pod时:
# kubectl create -f mysql.yaml
error: error validating "mysql.yaml": error validating data: couldn't find type: v1beta1.Deployment; if you choose to ignore these errors, turn validation off with --validate=false
原因:
kubectl 的版本是1.5版本的
# kubectl version
Client Version: version.Info{Major:"1", Minor:"5", GitVersion:"v1.5.2", GitCommit:"269f928217957e7126dc87e6adfa82242bfe5b1e", GitTreeState:"clean", BuildDate:"2017-07-03T15:31:10Z", GoVersion:"go1.7.4", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"5", GitVersion:"v1.5.2", GitCommit:"269f928217957e7126dc87e6adfa82242bfe5b1e", GitTreeState:"clean", BuildDate:"2017-07-03T15:31:10Z", GoVersion:"go1.7.4", Compiler:"gc", Platform:"linux/amd64"} 解决方法:
将mysql.yaml脚本中的 “ apiVersion: apps/v1beta1 ” 改为 “apiVersion: extensions/v1beta1 ” 即可
不同的apiversion解释:
apps API组将是v1部署类型所在的位置 . apps/v1beta1 版本已在1.6.0中添加,因此如果您有1.5.x客户端或服务器,则仍应使用 extensions/v1beta1 版本 .
apps/v1beta1 和 extensions/v1beta1 部署类型相同,但在通过 apps API创建时,会使用一些改进的默认值
最新文章
- HashMap多线程并发问题分析
- ubuntu 搭建PPTP VPN服务器
- 【C语言】外部函数和内部函数
- js闭包问题
- 用thinkPHP实现验证码的功能
- java根据sessionid获取session
- [Node.js] npm init &;&; npm install
- 最近Get到的一些HTML/CSS中的小点(一)
- leetcode 刷道题 70 earch Insert Position 二进制搜索插入位置
- Js 获取当前月的天数
- JavaScript成员属性读取
- 坐忘峰 golang入坑系列
- 介绍Docker仓库
- Linux下实现秒级定时任务的两种方案(crontab 每秒运行)
- 【codeforces 516B】Drazil and Tiles
- JIRA
- Python import hook
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.mybatis.spring.mapper.MapperScannerConfigurer#0'
- input type = file 上传图片转为base64
- Cobbler自动化批量安装Linux操作系统 - 运维总结
热门文章
- Ruby Programming学习笔记
- html 行内元素和块级元素
- Unknown class xxx in Interface Builder file. / NSUnknownKeyException
- Amphorae 与 Octavia Worker 的安全通信实现
- Java 生成 32位 UUID
- 针对C++容器类的一个简陋的allocator
- 如图 honehoneclock
- python学习之迭代器
- 【VS开发】在VS2010中开发ActiveX控件设置测试容器的方式
- 简述前后端分离的情况下,Vue实现点击图片下载到本地(并实现IE11浏览器的兼容)