highlight: a11y-dark
theme: cyanosis
注意:排错仅供参考!!!都是本人遇到问题时解决方法。
问题1:harbor
| 环境 | Ubuntu 1804 | | -- | ----------- |
报错信息
# docker login harbor.123.com
Username: admin
Password:
Error saving credentials: error storing credentials - err: exit status 1, out: `Failed to execute child process “dbus-launch” (No such file or directory)`
解决方法:
#1.删除包
sudo apt-get remove golang-docker-credential-helpers
#2。再次登录即可
docker login harbor.123.com
问题2:haproxy
| 环境 | Ubuntu 1804 | | -- | ----------- |
报错信息
# systemctl status haproxy
● haproxy.service - HAProxy Load Balancer
Loaded: loaded (/lib/systemd/system/haproxy.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2021-03-06 13:36:23 CST; 8min ago
Docs: man:haproxy(1)
file:/usr/share/doc/haproxy/configuration.txt.gz
Process: 3176 ExecStart=/usr/sbin/haproxy -Ws -f $CONFIG -p $PIDFILE $EXTRAOPTS (code=exited, stat
Process: 3167 ExecStartPre=/usr/sbin/haproxy -f $CONFIG -c -q $EXTRAOPTS (code=exited, status=0/SU
Main PID: 3176 (code=exited, status=1/FAILURE)
Mar 06 13:36:23 ha2 systemd[1]: haproxy.service: Service hold-off time over, scheduling restart.
Mar 06 13:36:23 ha2 systemd[1]: haproxy.service: Scheduled restart job, restart counter is at 5.
Mar 06 13:36:23 ha2 systemd[1]: Stopped HAProxy Load Balancer.
Mar 06 13:36:23 ha2 systemd[1]: haproxy.service: Start request repeated too quickly.
Mar 06 13:36:23 ha2 systemd[1]: haproxy.service: Failed with result 'exit-code'.
Mar 06 13:36:23 ha2 systemd[1]: Failed to start HAProxy Load Balancer.
解决方法:负载服务器上都要部署
#1.修改内核参数
vim /etc/sysctl.conf
net.ipv4.ip_nonlocal_bind = 1 <--允许非本地IP地址socket监听
#2.使内核参数生效
sysctl -p
#3.启动服务&&开机启动
systemctl restart haproxy && systemctl enable haproxy
问题3:harbor改为本地拉取镜像、因为老超时所以暂时搁置
| 环境 | Ubuntu 1804 | | -- | ----------- |
node1110
网络插件
#拉取镜像
docker pull mirrorgooglecontainers/pause-amd64:3.1
#修改tag号
docker tag mirrorgooglecontainers/pause-amd64:3.1 harbor.123.com/baseimages/pause-amd64:3.1
#登录 账号:admin 密码:123456
docker login harbor.123.com
#上传
docker push harbor.123.com/baseimages/pause-amd64:3.1
Master101
vim ./roles/kube-node/defaults/main.yml
# 默认使用kube-proxy的 'iptables' 模式,可选 'ipvs' 模式(experimental)
PROXY_MODE: "iptables"
# 基础容器镜像
SANDBOX_IMAGE: "harbor.123.com/baseimages/pause-amd64:3.1" <--改成内部地址
#SANDBOX_IMAGE: "mirrorgooglecontainers/pause-amd64:3.1" <--注释掉
#SANDBOX_IMAGE: "registry.access.redhat.com/rhel7/pod-infrastructure:latest"
# Kubelet 根目录
KUBELET_ROOT_DIR: "/var/lib/kubelet"
# node节点最大pod 数
MAX_PODS: 110
修改配置
vim /etc/systemd/system/kubelet.service
--max-pods=5000 \
# --pod-infra-container-image=mirrorgooglecontainers/pause-amd64:3.1 \ <--注释掉
--pod-infra-container-image=harbor.123.com/baseimages/pause-amd64:3.1 \ <--修改此行
重启服务
systemctl daemon-reload
systemctl restart kubelet
calico镜像下载地址:https://github.com/projectcalico/calico
上传后解压、打镜像
cd /opt
tar xvf release-v3.4.4.tgz
cd release-v3.4.4/images
#导入镜像1
docker load -i calico-cni.tar
#修改tag号
docker tag calico/cni:v3.4.4 harbor.123.com/baseimages/calico-cni:v3.4.4
#上传镜像
docker push harbor.123.com/baseimages/calico-cni:v3.4.4
#导入镜像2
docker load -i calico-node.tar
#修改tag号
docker tag calico/node:v3.4.4 harbor.123.com/baseimages/calico-node:v3.4.4
#上传镜像
docker push harbor.123.com/baseimages/calico-node:v3.4.4
#导入镜像3
docker load -i calico-kube-controllers.tar
#修改tag号
docker tag calico/kube-controllers:v3.4.4 harbor.123.com/baseimages/kube-controllers:v3.4.4
#上传镜像
docker push harbor.123.com/baseimages/kube-controllers:v3.4.4
此步骤不要出错、否则后期排错非常麻烦!!!
vim /etc/ansible/roles/calico/templates/calico-v3.4.yaml.j2
- name: install-cni
#注释掉下行后、添加新的
# image: calico/cni:{{ calico_ver }}
image: harbor.123.com/baseimages/calico-cni:v3.4.4
- name: calico-node
#注释掉下行后、添加新的
# image: calico/node:{{ calico_ver }}
image: harbor.123.com/baseimages/calico-node:v3.4.4
- name: calico-kube-controllers
#注释掉下行后、添加新的
# image: calico/kube-controllers:{{ calico_ver }}
image: harbor.123.com/baseimages/kube-controllers:v3.4.4
问题4:没有Redis模块
| 环境 | Ubuntu 1804 | | -- | ----------- |
报错信息
# python3 redis_monitor.sh
Traceback (most recent call last):
File "redis_monitor.sh", line 4, in <module>
import redis
ModuleNotFoundError: No module named 'redis'
解决方法:使用pip安装redis
apt install python-pip -y
pip install redis
#查看版本pip 9.0.1(python 2.7)
# pip --version
pip 9.0.1 from /usr/lib/python2.7/dist-packages (python 2.7)
问题5:更改gem源
| 环境 | Ubuntu 1804 | | -- | ----------- |
国内网站:https://gems.ruby-china.com/
```js
安装
apt install gem && apt install ruby
查看gem源列表
gem source list
* CURRENT SOURCES *
https://rubygems.org/
添加新的源地址并删除旧的
gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/
查看gem源列表(以换成新的)
gem source list
* CURRENT SOURCES *
https://gems.ruby-china.com/ ```
持续更新...