1. apt-get错误
以前作别的项目遗留问题,签名失效
~$ apt-get update && apt-get install -y apt-transport-https
正在读取软件包列表… 完成
W: 校验数字签名时出错。此仓库未被更新,所以仍然使用此前的索引文件。GPG 错误:http://packages.ros.org/ros/ubuntu bionic InRelease: 下列签名无效: EXPKEYSIG F42ED6FBAB17C654 Open Robotics info@osrfoundation.org
W: 无法下载 http://packages.ros.org/ros/ubuntu/dists/bionic/InRelease 下列签名无效: EXPKEYSIG F42ED6FBAB17C654 Open Robotics info@osrfoundation.org
W: 部分索引文件下载失败。如果忽略它们,那将转而使用旧的索引文件。
E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?
解决方法:
sudo apt-key adv --refresh-keys --keyserver keyserver.ubuntu.com
E: Conflicting values set for option Signed-By regarding source http://mirrors.aliyun.com/kubernetes/apt/ kubernetes-xenial: /usr/share/keyrings/kubernetes-archive-keyring.gpg !=
E: The list of sources could not be read.
E: Conflicting values set for option Signed-By regarding source http://mirrors.aliyun.com/kubernetes/apt/ kubernetes-xenial: /usr/share/keyrings/kubernetes-archive-keyring.gpg !=
E: The list of sources could not be read.
问题原因:存在多个密钥
解决方法:
vi /etc/apt/sources.list.d/kubernetes.list #确保只有一行
2. Permission denied
~$ apt-get update && apt-get install -y apt-transport-https
Reading package lists… Done
E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?
问题原因:ubuntu默认不允许使用root登录,因此初始root账户是不能使用的,需要在普通账户下利用sudo权限修改root密码。
解决方法:
- 设置root密码
sudo passwd root
- 按提示设置密码后运行su使用root用户操作
su
3. go: command not found
root@master:/home# cd $GOPATH/src/github.com/kubeedge/kubeedge
root@master:/data/gopath/src/github.com/kubeedge/kubeedge# make all WHAT=keadm
hack/verify-golang.sh
hack/verify-golang.sh: line 26: go: command not found
go detail version:
hack/verify-golang.sh: line 28: go: command not found
Makefile:67: recipe for target ‘verify-golang’ failed
make: *** [verify-golang] Error 127
解决方法:参考https://www.jianshu.com/p/c98ba4363762,创建软链接
sudo ln -fs /usr/local/go/bin/go /usr/local/bin/go
再次运行make指令成功
4. kubectl 错误
root@master:/home/zora# kubectl get nodes
E1120 04:00:46.929276 37729 memcache.go:265] couldn’t get current server API group list: Get “http://localhost:8080/api?timeout=32s”: dial tcp 127.0.0.1:8080: connect: connection refused
E1120 04:00:46.929672 37729 memcache.go:265] couldn’t get current server API group list: Get “http://localhost:8080/api?timeout=32s”: dial tcp 127.0.0.1:8080: connect: connection refused
E1120 04:00:46.939033 37729 memcache.go:265] couldn’t get current server API group list: Get “http://localhost:8080/api?timeout=32s”: dial tcp 127.0.0.1:8080: connect: connection refused
E1120 04:00:46.939595 37729 memcache.go:265] couldn’t get current server API group list: Get “http://localhost:8080/api?timeout=32s”: dial tcp 127.0.0.1:8080: connect: connection refused
E1120 04:00:46.942656 37729 memcache.go:265] couldn’t get current server API group list: Get “http://localhost:8080/api?timeout=32s”: dial tcp 127.0.0.1:8080: connect: connection refused
The connection to the server localhost:8080 was refused - did you specify the right host or port?
解决方法:
echo "export KUBECONFIG=/etc/kubernetes/admin.conf" >> ~/.bash_profile
source ~/.bash_profile
如果不行就看看kubelet的状态,可能是没启动,使用重启大法
systemctl restart docker
systemctl restart kubelet
5. kudeadm init问题
参考
[preflight] Running pre-flight checks
[WARNING FileAvailable–etc-kubernetes-manifests-kube-apiserver.yaml]: /etc/kubernetes/manifests/kube-apiserver.yaml already exists
[WARNING FileAvailable–etc-kubernetes-manifests-kube-controller-manager.yaml]: /etc/kubernetes/manifests/kube-controller-manager.yaml already exists
[WARNING FileAvailable–etc-kubernetes-manifests-kube-scheduler.yaml]: /etc/kubernetes/manifests/kube-scheduler.yaml already exists
[WARNING FileAvailable–etc-kubernetes-manifests-etcd.yaml]: /etc/kubernetes/manifests/etcd.yaml already exists
[WARNING Swap]: swap is enabled; production deployments should disable swap unless testing the NodeSwap feature gate of the kubelet
kubeadm reset --cri-socket=unix:///var/run/cri-dockerd.sock
W1122 23:15:01.059329 22749 checks.go:835] detected that the sandbox image “registry.k8s.io/pause:3.6” of the container runtime is inconsistent with that used by kubeadm. It is recommended that using “registry.aliyuncs.com/google_containers/pause:3.9” as the CRI sandbox image.
sudo systemctl stop cri-docker
vi /usr/lib/systemd/system/cri-docker.service #在ExecStart行最后面添加 `--pod-infra-container-image=registry.aliyuncs.com/google_containers/pause:3.9`
sudo systemctl daemon-reload
sudo systemctl start cri-docker
6. 网络配置问题
参考
使用apt时报错:"Could not resolve host: mirrors.tuna.tsinghua.edu.cn“
解决方法:
- 在设置-网络和Internet中找到VMnet8,点击更多适配器选项
- 点开IPv4,设置IP和DNS为虚拟机虚拟网络编辑器的NAT设置中的VMnet8的网关地址
- sudo vim /etc/NetworkManager/NetworkManager.conf,将managed=false 改成true参考