k8s问题记录
# error: You must be logged in to the server (the server has asked for the client to provide credentials)
解决:
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
注意:
不能使用:
echo "export KUBECONFIG=/etc/kubernetes/admin.conf" >> ~/.bash_profile
source ~/.bash_profile
否则 ssh 远程 执行会有问题
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
# network is not ready: container runtime network not ready: NetworkRedy=false reason:NetworkPluginNotReady message:Network plugin returns error: cni plugin not initialized
1
# The HTTP call equal to ‘curl -sSL http://localhost:10248/healthz’ failed with error: Get “http://localhost:10248/healthz”: dial tcp [::1]:10248: connect: connection refused.
## 交换分区开着导致 k8s 不能进行初始化
#查看现有的交换分区
root@master1:~# swapon -s
Filename Type Size Used Priority
/dev/sda2 partition 3906556 1036 -2
#关闭所有的交换分区
root@master1:~# swapoff -a
#再次查看 已经没有打开的交换分区了
root@master1:~# swapon -s
1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12