报错处理一:
### --- 报错现象:
localhost:8080 was refused
### --- 报错分析:
# kubectl get po
The connection to the server localhost:8080 was refused - did you specify the right host or port?
### --- 解决方案:
[root@k8s-master01 ~]# rm -f ~/.kube/config
[root@k8s-master01 ~]# cp /etc/kubernetes/admin.kubeconfig ~/.kube/config
报错处理二:
### --- 报错现象:apiserver无法启动
[root@k8s-master01 ~]# kubectl create -f nginx-deploy.yaml
Error from server (InternalError):an error on the server ("") has prevented the request from succeeding
### --- OR
[root@k8s-master01 ~]# systemctl status kube-apiserver
● kube-apiserver.service - Kubernetes API Server
Loaded: loaded (/usr/lib/systemd/system/kube-apiserver.service; enabled; vendor preset: disabled)
Active: inactive (dead) since Thu 2021-07-15 19:01:22 CST; 1min 22s ago
Docs: https://github.com/kubernetes/kubernetes
Process: 1612 ExecStart=/usr/local/bin/kube-apiserver \ (code=exited, status=1/FAILURE)
### --- 报错分析:
~~~ ——>因为apiserver的配置文件找不到
### --- 解决方案:
~~~ ——>需要把apiserver的配置文件,从word中复制到notepad中,然后在复制到服务器上,
~~~ ——>之后执行systemctl daemon-reload && systemctl restart kube-apiserver
~~~ ——>其他组件类似报错一样