gpt4 book ai didi

kubernetes - 编织网Pod处于挂起状态,调度程序日志中存在错误

转载 作者:行者123 更新时间:2023-12-02 11:43:13 26 4
gpt4 key购买 nike

我正在尝试建立一个新的kubernetes集群,并面临使用weave作为网络解决方案的问题。编织 Pane 挂起处于挂起状态,并且kubectl命令行没有可用的事件/日志。

我正在尝试从头开始设置kubernetes集群,作为在线类(class)的一部分。我已经设置了主节点-并启动了api服务器, Controller 管理器和调度程序。运行kubelet和kube-proxy的工作程序节点。

节点状态:

vagrant@master-1:~$ kubectl get nodes -n kube-system
NAME STATUS ROLES AGE VERSION
worker-1 NotReady <none> 25h v1.13.0
worker-2 NotReady <none> 9h v1.13.0

作为启用联网的下一步,我正在使用编织。我已经在员工节点上安装了weave并解压缩。

现在,当我尝试运行以下命令时:
kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')"
我看到DaemonSet已初始化,但是创建的Pod继续处于“待处理状态”。
vagrant@master-1:~$ kubectl get pods -n kube-system
NAME READY STATUS RESTARTS AGE
weave-net-ccrqs 0/2 Pending 0 73m
weave-net-vrm5f 0/2 Pending 0 73m

下面的命令: vagrant@master-1:~$ kubectl describe pods -n kube-system不返回任何正在进行的事件。

从调度程序服务日志中,我可以看到以下记录的错误。
Oct 13 16:46:51 master-2 kube-scheduler[14569]: E1013 16:46:51.973883   14569 reflector.go:134] k8s.io/client-go/informers/factory.go:132: Failed to list *v1.StatefulSet: statefulsets.apps is forbidden: User "system:anonymous" cannot list resource "statefulsets" in API group "apps" at the cluster scope
Oct 13 16:46:51 master-2 kube-scheduler[14569]: E1013 16:46:51.982228 14569 reflector.go:134] k8s.io/client-go/informers/factory.go:132: Failed to list *v1.StorageClass: storageclasses.storage.k8s.io is forbidden: User "system:anonymous" cannot list resource "storageclasses" in API group "storage.k8s.io" at the cluster scope
Oct 13 16:46:52 master-2 kube-scheduler[14569]: E1013 16:46:52.338171 14569 reflector.go:134] k8s.io/client-go/informers/factory.go:132: Failed to list *v1.PersistentVolume: persistentvolumes is forbidden: User "system:anonymous" cannot list resource "persistentvolumes" in API group "" at the cluster scope
Oct 13 16:46:52 master-2 kube-scheduler[14569]: E1013 16:46:52.745288 14569 reflector.go:134] k8s.io/client-go/informers/factory.go:132: Failed to list *v1.Service: services is forbidden: User "system:anonymous" cannot list resource "services" in API group "" at the cluster scope
Oct 13 16:46:52 master-2 kube-scheduler[14569]: E1013 16:46:52.765103 14569 reflector.go:134] k8s.io/client-go/informers/factory.go:132: Failed to list *v1beta1.PodDisruptionBudget: poddisruptionbudgets.policy is forbidden: User "system:anonymous" cannot list resource "poddisruptionbudgets" in API group "policy" at the cluster scope
Oct 13 16:46:52 master-2 kube-scheduler[14569]: E1013 16:46:52.781419 14569 reflector.go:134] k8s.io/client-go/informers/factory.go:132: Failed to list *v1.ReplicaSet: replicasets.apps is forbidden: User "system:anonymous" cannot list resource "replicasets" in API group "apps" at the cluster scope
Oct 13 16:46:52 master-2 kube-scheduler[14569]: E1013 16:46:52.785872 14569 reflector.go:134] k8s.io/client-go/informers/factory.go:132: Failed to list *v1.ReplicationController: replicationcontrollers is forbidden: User "system:anonymous" cannot list resource "replicationcontrollers" in API group "" at the cluster scope
Oct 13 16:46:52 master-2 kube-scheduler[14569]: E1013 16:46:52.786117 14569 reflector.go:134] k8s.io/kubernetes/cmd/kube-scheduler/app/server.go:232: Failed to list *v1.Pod: pods is forbidden: User "system:anonymous" cannot list resource "pods" in API group "" at the cluster scope
Oct 13 16:46:52 master-2 kube-scheduler[14569]: E1013 16:46:52.786790 14569 reflector.go:134] k8s.io/client-go/informers/factory.go:132: Failed to list *v1.Node: nodes is forbidden: User "system:anonymous" cannot list resource "nodes" in API group "" at the cluster scope
Oct 13 16:46:52 master-2 kube-scheduler[14569]: E1013 16:46:52.787016 14569 reflector.go:134] k8s.io/client-go/informers/factory.go:132: Failed to list *v1.PersistentVolumeClaim: persistentvolumeclaims is forbidden: User "system:anonymous" cannot list resource "persistentvolumeclaims" in API group "" at the cluster scope

由于我是kubernetes的新手,如果我错过添加相关信息,请原谅。立即分享。需要帮助。

为调度程序添加了kubeconfig:
    {
kubectl config set-cluster kubernetes-the-hard-way \
--certificate-authority=ca.crt \
--embed-certs=true \
--server=https://127.0.0.1:6443 \
--kubeconfig=kube-scheduler.kubeconfig

kubectl config set-credentials system:kube-scheduler \
--client-certificate=kube-scheduler.crt \
--client-key=kube-scheduler.key \
--embed-certs=true \
--kubeconfig=kube-scheduler.kubeconfig

kubectl config set-context default \
--cluster=kubernetes-the-hard-way \
--user=system:kube-scheduler \
--kubeconfig=kube-scheduler.kubeconfig

kubectl config use-context default --kubeconfig=kube-
scheduler.kubeconfig
}

添加了调度程序服务定义:
cat <<EOF | sudo tee /etc/systemd/system/kube-scheduler.service
[Unit]
Description=Kubernetes Scheduler
Documentation=https://github.com/kubernetes/kubernetes

[Service]
ExecStart=/usr/local/bin/kube-scheduler \\
--kubeconfig=/var/lib/kubernetes/kube-scheduler.kubeconfig \\
--address=127.0.0.1 \\
--leader-elect=true \\
--v=2
Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target
EOF

使用以下命令启动调度程序:
sudo systemctl enable kube-scheduler
sudo systemctl start kube-scheduler

组件状态:
vagrant@master-1:~$ kubectl get componentstatuses --kubeconfig admin.kubeconfig
NAME STATUS MESSAGE ERROR
scheduler Healthy ok
controller-manager Healthy ok
etcd-0 Healthy {"health":"true"}
etcd-1 Healthy {"health":"true"}

最佳答案

我已经在参与HA的两个主节点上重新启动了kube调度程序和 Controller 管理器,我认为这允许api服务器的负载均衡器URL生效,并且消除了前面观察到的错误。

之后,我设置了一个工作节点并安装了编织,部署了pod并准备好节点。

vagrant@master-1:~$ kubectl get pods -n kube-system
NAME READY STATUS RESTARTS AGE
weave-net-zswht 1/2 Running 0 41s
vagrant@master-1:~$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
worker-1 Ready <none> 4m51s v1.13.0

关于kubernetes - 编织网Pod处于挂起状态,调度程序日志中存在错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58366233/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com