有用的解决方法:

实际上,这个问题是因为没有给集群的pod指定内网网段的缘故。最彻底的解决办法是将这个集群所有节点重新kubeadm reset,重新初始化,并在初始化时指定内网网段:

kubeadm init --image-repository=registry.aliyuncs.com/google_containers --pod-network-cidr=10.244.0.0/16


解决k8s配置时不能打开/run/flannel/subnet.env的问题 - 简书

之后kubectl create -f nginx-pod.yaml时

之后又出现了:

Unable to connect to the server: tls: failed to verify certificate: x509: certificate signed by unknown authority (possibly because of "crypto/rsa: verification error" while trying to verify candidate authority certificate "kubernetes"

解决方法:

mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config

Unable to connect to the server x509 certificate signed by unknown authority possibly because of crypto rsa verification error | Edureka Community

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐