gpt4 book ai didi

即使节点处于就绪状态,Kubernetes pod 也不会启动

转载 作者:行者123 更新时间:2023-12-01 08:47:44 26 4
gpt4 key购买 nike

我是 kubernetes 的新手,我正在努力开始我的第一个 pod 。
我在我的 Ubuntu 虚拟机上安装了 kubernetes,然后继续

kubeadm init

其次是其他指示
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config

You should now deploy a pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
https://kubernetes.io/docs/concepts/cluster-administration/addons/

我可以看到节点已启动并正在运行
kubectl get nodes
NAME STATUS ROLES AGE VERSION
vm24740 Ready master 12m v1.10.0

尽管如此,我的 pod 不会启动:
kubectl get pods
NAME READY STATUS RESTARTS AGE
myappdeployment-588bc8ddf4-28jzj 0/1 Pending 0 11m
myappdeployment-588bc8ddf4-9bbb9 0/1 Pending 0 11m
myappdeployment-588bc8ddf4-fptft 0/1 Pending 0 11m
myappdeployment-588bc8ddf4-lxj8p 0/1 Pending 0 11m
myappdeployment-588bc8ddf4-xhg5f 0/1 Pending 0 11m

这是 Pod 的详细 View :
kubectl describe pod myappdeployment-588bc8ddf4-28jzj
Name: myappdeployment-588bc8ddf4-28jzj
Namespace: default
Node: <none>
Labels: app=myapp
pod-template-hash=1446748890
Annotations: <none>
Status: Pending
IP:
Controlled By: ReplicaSet/myappdeployment-588bc8ddf4
Containers:
myapp:
Image: jamesquigley/exampleapp:v1.0.0
Port: 9000/TCP
Host Port: 0/TCP
Environment: <none>
Mounts:
/var/run/secrets/kubernetes.io/serviceaccount from default-token-6rcjb (ro)
Conditions:
Type Status
PodScheduled False
Volumes:
default-token-6rcjb:
Type: Secret (a volume populated by a Secret)
SecretName: default-token-6rcjb
Optional: false
QoS Class: BestEffort
Node-Selectors: <none>
Tolerations: node.kubernetes.io/not-ready:NoExecute for 300s
node.kubernetes.io/unreachable:NoExecute for 300s
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Warning FailedScheduling 1m (x37 over 11m) default-scheduler 0/1 nodes are available: 1 node(s) had taints that the pod didn't tolerate.

比我更有经验的人会知道,为什么 pod 不启动?

最佳答案

看起来您正在运行单节点(主)k8s:

来自 Documentation :

Master Isolation

By default, your cluster will not schedule pods on the master for security reasons. If you want to be able to schedule pods on the master, e.g. for a single-machine Kubernetes cluster for development, run:

kubectl taint nodes --all node-role.kubernetes.io/master-

With output looking something like:

node "test-01" untainted
taint key="dedicated" and effect="" not found.
taint key="dedicated" and effect="" not found
.

This will remove the node-role.kubernetes.io/master taint from any nodes that have it, including the master node, meaning that the scheduler will then be able to schedule pods everywhere.

关于即使节点处于就绪状态,Kubernetes pod 也不会启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49764198/

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