kubernetes常见问题

1.kube-apiserver 的服务无法启动

Unable to perform initial IP allocation check: unable to refresh the service IP block: etcdserver: leader changed

stemctl status kube-apiserver
â kube-apiserver.service - Kubernetes API Server
   Loaded: loaded (/usr/lib/systemd/system/kube-apiserver.service; disabled; vendor preset: disabled)
   Active: failed (Result: start-limit) since Wed 2024-01-31 16:44:49 CST; 6s ago
     Docs: https://github.com/GoogleCloudPlatform/kubernetes
  Process: 13583 ExecStart=/usr/bin/kube-apiserver $KUBE_LOGTOSTDERR $KUBE_LOG_LEVEL $KUBE_ETCD_SERVERS $KUBE_API_ADDRESS $KUBE_API_PORT $KUBELET_PORT $KUBE_ALLOW_PRIV $KUBE_SERVICE_ADDRESSES $KUBE_ADMISSION_CONTROL $KUBE_API_ARGS (code=exited, status=255)
 Main PID: 13583 (code=exited, status=255)

Jan 31 16:44:49 bigdataserver.esrichina.com systemd[1]: Unit kube-apiserver.service entered failed state.
Jan 31 16:44:49 bigdataserver.esrichina.com systemd[1]: kube-apiserver.service failed.
Jan 31 16:44:49 bigdataserver.esrichina.com systemd[1]: kube-apiserver.service holdoff time over, scheduling restart.
Jan 31 16:44:49 bigdataserver.esrichina.com systemd[1]: Stopped Kubernetes API Server.
Jan 31 16:44:49 bigdataserver.esrichina.com systemd[1]: start request repeated too quickly for kube-apiserver.service
Jan 31 16:44:49 bigdataserver.esrichina.com systemd[1]: Failed to start Kubernetes API Server.
Jan 31 16:44:49 bigdataserver.esrichina.com systemd[1]: Unit kube-apiserver.service entered failed state.
Jan 31 16:44:49 bigdataserver.esrichina.com systemd[1]: kube-apiserver.service failed.
[root@bigdataserver kube_yaml]# journalctl -xeu kubelet
Jan 31 16:44:57 bigdataserver.esrichina.com kubelet[3331]: I0131 16:44:57.666085    3331 kubelet_node_status.go:74] Attempting to register node 127.0.0.1
Jan 31 16:44:57 bigdataserver.esrichina.com kubelet[3331]: E0131 16:44:57.667040    3331 kubelet_node_status.go:98] Unable to register node "127.0.0.1" with API server

无法注册通过127.0.0.1:2379注册到etcd中,应该是etcd有问题

2. 查看etcd的状态

kubernetes常见问题_第1张图片

默认etcd并不监控127.0.0.1的2379端口,只监控IP:2379

解决方法:

修改/etc/etcd/etcd.conf 中的 ETCD_LISTEN_CLIENT_URLS="http://0.0.0.0:2379",让其监控所有ip

3. 

 kubectl create -f test.yaml
Unable to connect to the server: x509: certificate signed by unknown authority

解决方法:

参考

kubectl 命令执行报错:(Unable to connect to the server: x509: certificate signed by unknown authority )_kubectl unable to connect to the server: x509: cer-CSDN博客

4. 使用kubectl create -f rc_name.yaml后,失败。

kubectl describe ReplicationController/rc_name 

报API token found for service account "default" , retry after the token is automatically created and added to the service account

可以参考解决

解决k8s创建pod报错No API token found for service account "default", retry after the token is automatically_error from server: error when creating "busybox.ya-CSDN博客

你可能感兴趣的:(kubernetes,容器,云原生)