kube系统容器不断崩溃

时间:2019-06-03 22:44:50

标签: kubernetes

我用kubeadm init --pod-network-cidr=10.1.0.0/16在主节点上初始化了一个新集群,并安装了Calico,一切似乎都可以正常工作:

sysadm@master$ sudo kubectl get pods --all-namespaces -o wide
[sudo] password for sysadm:
NAMESPACE     NAME                                            READY   STATUS    RESTARTS   AGE     IP              NODE                    NOMINATED NODE   READINESS GATES
kube-system   calico-node-ntzn2                               2/2     Running   0          4m9s    192.168.0.249   localhost.localdomain   <none>           <none>
kube-system   coredns-fb8b8dccf-hqmn2                         1/1     Running   0          4m9s    10.1.0.2        localhost.localdomain   <none>           <none>
kube-system   coredns-fb8b8dccf-nfgr5                         1/1     Running   0          4m9s    10.1.0.3        localhost.localdomain   <none>           <none>
kube-system   etcd-localhost.localdomain                      1/1     Running   0          3m4s    192.168.0.249   localhost.localdomain   <none>           <none>
kube-system   kube-apiserver-localhost.localdomain            1/1     Running   0          3m18s   192.168.0.249   localhost.localdomain   <none>           <none>
kube-system   kube-controller-manager-localhost.localdomain   1/1     Running   0          3m23s   192.168.0.249   localhost.localdomain   <none>           <none>
kube-system   kube-proxy-xgnlb                                1/1     Running   0          4m9s    192.168.0.249   localhost.localdomain   <none>           <none>
kube-system   kube-scheduler-localhost.localdomain            1/1     Running   0          3m11s   192.168.0.249   localhost.localdomain   <none>           <none>

但是,当我尝试使用kubeadm join "$api_server_endpoint" --token "$token" --discovery-token-ca-cert-hash "$hash"将工作节点加入主节点时,所有kube-system容器开始崩溃:

sysadm@master$ sudo kubectl get pods --all-namespaces -o wide
NAMESPACE     NAME                      READY   STATUS             RESTARTS   AGE   IP              NODE                    NOMINATED NODE   READINESS GATES   
kube-system   calico-node-ntzn2         2/2     Running            0          10m   192.168.0.182   localhost.localdomain   <none>           <none>            
kube-system   coredns-fb8b8dccf-hqmn2   0/1     CrashLoopBackOff   2          10m   10.1.0.2        localhost.localdomain   <none>           <none>            
kube-system   coredns-fb8b8dccf-nfgr5   0/1     CrashLoopBackOff   1          10m   10.1.0.3        localhost.localdomain   <none>           <none>
kube-system   kube-proxy-xgnlb          1/1     Running            0          10m   192.168.0.166   localhost.localdomain   <none>           <none>
sysadm@master$ sudo kubectl get pods --all-namespaces -o wide
NAMESPACE     NAME                                            READY   STATUS             RESTARTS   AGE   IP              NODE                    NOMINATED NODE   READINESS GATES
kube-system   calico-node-ntzn2                               2/2     Running            0          11m   192.168.0.166   localhost.localdomain   <none>           <none>
kube-system   coredns-fb8b8dccf-hqmn2                         0/1     CrashLoopBackOff   2          11m   10.1.0.2        localhost.localdomain   <none>           <none>
kube-system   coredns-fb8b8dccf-nfgr5                         0/1     CrashLoopBackOff   2          11m   10.1.0.3        localhost.localdomain   <none>           <none>
kube-system   etcd-localhost.localdomain                      0/1     Pending            0          1s    <none>          localhost.localdomain   <none>           <none>
kube-system   kube-apiserver-localhost.localdomain            0/1     Pending            0          1s    <none>          localhost.localdomain   <none>           <none>
kube-system   kube-controller-manager-localhost.localdomain   0/1     Pending            0          1s    <none>          localhost.localdomain   <none>           <none>
kube-system   kube-proxy-xgnlb                                1/1     Running            0          11m   192.168.0.249   localhost.localdomain   <none>           <none>
sysadm@master$ sudo kubectl get pods --all-namespaces -o wide
NAMESPACE     NAME                                   READY   STATUS    RESTARTS   AGE   IP              NODE                    NOMINATED NODE   READINESS GATES
kube-system   calico-node-ntzn2                      2/2     Running   0          11m   192.168.0.182   localhost.localdomain   <none>           <none>
kube-system   coredns-fb8b8dccf-hqmn2                0/1     Running   3          11m   10.1.0.2        localhost.localdomain   <none>           <none>
kube-system   coredns-fb8b8dccf-nfgr5                0/1     Running   2          11m   10.1.0.3        localhost.localdomain   <none>           <none>
kube-system   kube-proxy-xgnlb                       1/1     Running   0          11m   192.168.0.166   localhost.localdomain   <none>           <none>
kube-system   kube-scheduler-localhost.localdomain   0/1     Pending   0          0s    <none>          localhost.localdomain   <none>           <none>
sysadm@master$ sudo kubectl get pods --all-namespaces -o wide
NAMESPACE     NAME                      READY   STATUS    RESTARTS   AGE   IP              NODE                    NOMINATED NODE   READINESS GATES
kube-system   calico-node-ntzn2         2/2     Running   0          11m   192.168.0.182   localhost.localdomain   <none>           <none>
kube-system   coredns-fb8b8dccf-hqmn2   1/1     Running   0          11m   10.1.0.2        localhost.localdomain   <none>           <none>
kube-system   coredns-fb8b8dccf-nfgr5   1/1     Running   0          11m   10.1.0.3        localhost.localdomain   <none>           <none>
kube-system   kube-proxy-xgnlb          1/1     Running   0          11m   192.168.0.166   localhost.localdomain   <none>           <none>
sysadm@master$ sudo kubectl get pods --all-namespaces -o wide
NAMESPACE     NAME                                   READY   STATUS    RESTARTS   AGE   IP              NODE                    NOMINATED NODE   READINESS GATES
kube-system   calico-node-ntzn2                      2/2     Running   0          11m   192.168.0.166   localhost.localdomain   <none>           <none>
kube-system   coredns-fb8b8dccf-hqmn2                0/1     Error     2          11m   10.1.0.2        localhost.localdomain   <none>           <none>
kube-system   coredns-fb8b8dccf-nfgr5                1/1     Running   0          11m   10.1.0.3        localhost.localdomain   <none>           <none>
kube-system   kube-proxy-xgnlb                       1/1     Running   0          11m   192.168.0.249   localhost.localdomain   <none>           <none>
kube-system   kube-scheduler-localhost.localdomain   0/1     Pending   0          0s    <none>          localhost.localdomain   <none>           <none>
sysadm@master$ sudo kubectl get pods --all-namespaces -o wide
NAMESPACE     NAME                         READY   STATUS             RESTARTS   AGE   IP              NODE                    NOMINATED NODE   READINESS GATES
kube-system   calico-node-ntzn2            2/2     Running            0          11m   192.168.0.249   localhost.localdomain   <none>           <none>
kube-system   coredns-fb8b8dccf-hqmn2      0/1     CrashLoopBackOff   2          11m   10.1.0.2        localhost.localdomain   <none>           <none>
kube-system   coredns-fb8b8dccf-nfgr5      1/1     Running            0          11m   10.1.0.3        localhost.localdomain   <none>           <none>
kube-system   etcd-localhost.localdomain   0/1     Pending            0          1s    <none>          localhost.localdomain   <none>           <none>
kube-system   kube-proxy-xgnlb             1/1     Running            0          11m   192.168.0.166   localhost.localdomain   <none>           <none>
sysadm@master$ sudo kubectl get pods --all-namespaces -o wide
NAMESPACE     NAME                                   READY   STATUS    RESTARTS   AGE   IP              NODE                    NOMINATED NODE   READINESS GATES
kube-system   calico-node-ntzn2                      2/2     Running   0          11m   192.168.0.182   localhost.localdomain   <none>           <none>
kube-system   coredns-fb8b8dccf-hqmn2                0/1     Error     3          11m   10.1.0.2        localhost.localdomain   <none>           <none>
kube-system   coredns-fb8b8dccf-nfgr5                0/1     Error     2          11m   10.1.0.3        localhost.localdomain   <none>           <none>
kube-system   kube-apiserver-localhost.localdomain   0/1     Pending   0          0s    <none>          localhost.localdomain   <none>           <none>
kube-system   kube-proxy-xgnlb                       1/1     Running   0          11m   192.168.0.249   localhost.localdomain   <none>           <none>
sysadm@master$ sudo kubectl get pods --all-namespaces -o wide
NAMESPACE     NAME                      READY   STATUS             RESTARTS   AGE   IP              NODE                    NOMINATED NODE   READINESS GATES
kube-system   calico-node-ntzn2         2/2     Running            0          11m   192.168.0.249   localhost.localdomain   <none>           <none>
kube-system   coredns-fb8b8dccf-hqmn2   1/1     Running            0          11m   10.1.0.2        localhost.localdomain   <none>           <none>
kube-system   coredns-fb8b8dccf-nfgr5   0/1     CrashLoopBackOff   2          11m   10.1.0.3        localhost.localdomain   <none>           <none>
kube-system   kube-proxy-xgnlb          1/1     Running            0          11m   192.168.0.166   localhost.localdomain   <none>           <none>
sysadm@master$ sudo kubectl get pods --all-namespaces -o wide
NAMESPACE     NAME                      READY   STATUS             RESTARTS   AGE   IP              NODE                    NOMINATED NODE   READINESS GATES
kube-system   calico-node-ntzn2         2/2     Running            0          11m   192.168.0.249   localhost.localdomain   <none>           <none>
kube-system   coredns-fb8b8dccf-hqmn2   0/1     Running            3          11m   10.1.0.2        localhost.localdomain   <none>           <none>
kube-system   coredns-fb8b8dccf-nfgr5   0/1     CrashLoopBackOff   2          11m   10.1.0.3        localhost.localdomain   <none>           <none>
kube-system   kube-proxy-xgnlb          1/1     Running            0          11m   192.168.0.166   localhost.localdomain   <none>           <none>

有什么想法吗?我该如何解决?我尝试使用kubectl describe pods,但pod继续崩溃,当我能够取回一些信息时,没有发现任何东西可以引导我下一步去研究。

对不起,请提供模糊的详细信息。如果您可以将我指向其他地方,则可以发布更多详细信息或知道下一步要进行调查。

谢谢您的时间:)

1 个答案:

答案 0 :(得分:1)

issue使用主机名。检查NODENAME列。它显示主机名为localhost.localdomain

将主机名更新为k8s-master或master。它应该工作。每个节点还应具有唯一的主机名,例如node1,node2,node3等