You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

VirtualBox双VM搭建K8s集群,Nginx Pod始终Pending求助

Hey there, let's break down why your Nginx pods are stuck in the Pending state, using the details from your pod describe output:

Root Cause Analysis

Looking at the Events section of your pod description, the key error says:

0/2 nodes are available: 1 node(s) had taints that the pod didn't tolerate, 1 node(s) were not ready, 1 node(s) were out of disk space.

This combines three overlapping issues—let's unpack each one and fix them step by step:


1. Master Node Taint (Expected Behavior)

By default, Kubernetes adds a node-role.kubernetes.io/master:NoSchedule taint to the master node, which prevents regular workload pods from being scheduled there. This is intentional (to keep master resources reserved for cluster control plane components), so we don't need to fix this unless you specifically want to run pods on the master.


2. Node Node is "Not Ready" + Out of Disk Space

This is the critical issue blocking your pods. Your kubectl get nodes initially showed kubernetes-node1 as Ready, but something changed afterward—most likely the node ran out of disk space, which triggered Kubernetes to mark it as Not Ready.

Fix Steps:

First, log into your node node via SSH:

ssh 192.168.56.4
a. Check Disk Usage

Verify the disk space issue:

df -h

You'll likely see one of your partitions is 100% full.

b. Free Up Disk Space

Clean up unnecessary resources to reclaim space:

  • Delete unused Docker images, containers, and volumes:
    docker system prune -a -f
    
  • Clean up large log files (common culprits in /var/log):
    # Find and delete logs over 100MB
    find /var/log -type f -size +100M | xargs rm -f
    
  • Remove any other large, unneeded files (e.g., old backups, temporary files).
c. Verify Node Status

After freeing up space, wait 2-3 minutes, then check if the node returns to Ready state from the master:

sudo kubectl get nodes

If it's still Not Ready, check the kubelet service on the node:

# On the node node
systemctl status kubelet
# Restart kubelet if needed
systemctl restart kubelet
d. Check Cluster Network Health

If the node is still Not Ready, make sure your cluster network plugin (e.g., Flannel, Calico) is running properly:

# On the master node
sudo kubectl get pods -n kube-system

Look for any pods in CrashLoopBackOff or Failed state—restart them if necessary.


3. Confirm Pod Scheduling

Once your node node is back to Ready state, your pending Nginx pods should automatically schedule and start running. You can check their status with:

sudo kubectl get pods

If you want to speed things up, you can delete the existing pending pods—Deployment will recreate them:

sudo kubectl delete pod nginx-deployment-64ff85b579-5vkdz nginx-deployment-64ff85b579-w84lf

内容的提问来源于stack exchange,提问作者codependent

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.28 04:21:32