记一次kube-apiserver启动失败排错
master的kube-apiserver启动失败
# systemctl status kube-apiserver ● kube-apiserver.service - Kubernetes API Server Loaded: loaded (/usr/lib/systemd/system/kube-apiserver.service; enabled; vendor preset: disabled) Active: failed (Result: start-limit) since 五 2020-05-22 14:15:53 CST; 5s ago Docs: https://github.com/kubernetes/kubernetes Process: 25519 ExecStart=/opt/kubernetes/bin/kube-apiserver $KUBE_APISERVER_OPTS (code=exited, status=1/FAILURE) Main PID: 25519 (code=exited, status=1/FAILURE) 5月 22 14:15:52 k8s-master01 kube-apiserver[25519]: --stderrthreshold severity logs at or above this threshold go to stderr (default 2) 5月 22 14:15:52 k8s-master01 kube-apiserver[25519]: -v, --v Level number for the log level verbosity (default 0) 5月 22 14:15:52 k8s-master01 kube-apiserver[25519]: --version version[=true] Print version information and quit 5月 22 14:15:52 k8s-master01 kube-apiserver[25519]: --vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging 5月 22 14:15:53 k8s-master01 systemd[1]: kube-apiserver.service holdoff time over, scheduling restart. 5月 22 14:15:53 k8s-master01 systemd[1]: Stopped Kubernetes API Server. 5月 22 14:15:53 k8s-master01 systemd[1]: start request repeated too quickly for kube-apiserver.service 5月 22 14:15:53 k8s-master01 systemd[1]: Failed to start Kubernetes API Server. 5月 22 14:15:53 k8s-master01 systemd[1]: Unit kube-apiserver.service entered failed state. 5月 22 14:15:53 k8s-master01 systemd[1]: kube-apiserver.service failed.
使用命令检查集群报错如下
# kubectl get node error: You must be logged in to the server (the server has asked for the client to provide credentials)
kube-apiserver日志没有报错
查看系统日志-i是不区分大小写
cat /var/log/messages|grep kube-apiserver|grep -i error
发现如下报错
Error: failed to create listener: failed to listen on 127.0.0.1:8080: listen tcp 127.0.0.1:8080: bind: address already in use
其他应用占用了8080端口
经过检查发现是 heketi服务占用了该端口停止就可以了