你这个问题信息太少了,我没法直接判断具体报什么错。不过在 CentOS 上部署 Kubernetes(k8s) 时,最常见的报错原因一般就下面这几类,你可以对照看看:
报错示例:
running with swap on is not supported
解决:
swapoff -a
sed -i '/swap/s/^/#/' /etc/fstab
报错示例:
Permission denied
或 kubelet 起不来
解决:
setenforce 0
sed -i 's/^SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
报错示例:
connection refused
Unable to connect to the server
解决:
systemctl stop firewalld
systemctl disable firewalld
或放通对应端口。
报错示例:
/proc/sys/net/bridge/bridge-nf-call-iptables does not exist
解决:
modprobe br_netfilter
cat > /etc/sysctl.d/k8s.conf <<EOF
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.ip_forward = 1
EOF
sysctl --system
报错示例:
failed to create sandbox
cgroup driver mismatch
解决:
containerd config default > /etc/containerd/config.toml
systemctl restart containerd
常见原因:
解决示例:
kubeadm init \
--pod-network-cidr=10.244.0.0/16 \
--image-repository=registry.aliyuncs.com/google_containers
✅ 建议:
如果你愿意,把下面任意一个贴出来:
kubectl 或 kubeadm 报错journalctl -u kubelet我可以直接告诉你 是哪一步、怎么改。