首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在Kubernetes集群上应用Calico网络时出现的错误

在Kubernetes集群上应用Calico网络时出现的错误
EN

Stack Overflow用户
提问于 2019-11-22 16:37:43
回答 2查看 1.1K关注 0票数 0

我使用以下命令执行kubeinit (我正在尝试在RHEL 7.6上设置Kubernetes )

代码语言:javascript
复制
kubeadm init --apiserver-advertise-address=15.217.230.99 --pod-network-cidr=15.232.10.195/27

我想用棉布网络。由于我不能使用192.168.0.0/16网络,所以我必须从calico.yaml中提取https://docs.projectcalico.org/v3.9/manifests/calico.yaml,然后修改CALICO_IPV4POOL_CIDR,使其值为15.232.10.195/27 (首先,我不知道这里是否正确。当我尝试使用命令(作为sudo用户)应用文件时,我对Kubernetes非常陌生,并试图设置我的第一个集群:

代码语言:javascript
复制
kubectl apply -f ./calico.yaml

我得到以下错误:

代码语言:javascript
复制
unable to recognize "./calico.yaml": Get http://localhost:8080/api?timeout=32s: dial tcp [::1]:8080: connect: connection refused
unable to recognize "./calico.yaml": Get http://localhost:8080/api?timeout=32s: dial tcp [::1]:8080: connect: connection refused
unable to recognize "./calico.yaml": Get http://localhost:8080/api?timeout=32s: dial tcp [::1]:8080: connect: connection refused
unable to recognize "./calico.yaml": Get http://localhost:8080/api?timeout=32s: dial tcp [::1]:8080: connect: connection refused
unable to recognize "./calico.yaml": Get http://localhost:8080/api?timeout=32s: dial tcp [::1]:8080: connect: connection refused
unable to recognize "./calico.yaml": Get http://localhost:8080/api?timeout=32s: dial tcp [::1]:8080: connect: connection refused
unable to recognize "./calico.yaml": Get http://localhost:8080/api?timeout=32s: dial tcp [::1]:8080: connect: connection refused
unable to recognize "./calico.yaml": Get http://localhost:8080/api?timeout=32s: dial tcp [::1]:8080: connect: connection refused
unable to recognize "./calico.yaml": Get http://localhost:8080/api?timeout=32s: dial tcp [::1]:8080: connect: connection refused
unable to recognize "./calico.yaml": Get http://localhost:8080/api?timeout=32s: dial tcp [::1]:8080: connect: connection refused
unable to recognize "./calico.yaml": Get http://localhost:8080/api?timeout=32s: dial tcp [::1]:8080: connect: connection refused
unable to recognize "./calico.yaml": Get http://localhost:8080/api?timeout=32s: dial tcp [::1]:8080: connect: connection refused
unable to recognize "./calico.yaml": Get http://localhost:8080/api?timeout=32s: dial tcp [::1]:8080: connect: connection refused
unable to recognize "./calico.yaml": Get http://localhost:8080/api?timeout=32s: dial tcp [::1]:8080: connect: connection refused
unable to recognize "./calico.yaml": Get http://localhost:8080/api?timeout=32s: dial tcp [::1]:8080: connect: connection refused
unable to recognize "./calico.yaml": Get http://localhost:8080/api?timeout=32s: dial tcp [::1]:8080: connect: connection refused
unable to recognize "./calico.yaml": Get http://localhost:8080/api?timeout=32s: dial tcp [::1]:8080: connect: connection refused
unable to recognize "./calico.yaml": Get http://localhost:8080/api?timeout=32s: dial tcp [::1]:8080: connect: connection refused
unable to recognize "./calico.yaml": Get http://localhost:8080/api?timeout=32s: dial tcp [::1]:8080: connect: connection refused
unable to recognize "./calico.yaml": Get http://localhost:8080/api?timeout=32s: dial tcp [::1]:8080: connect: connection refused
unable to recognize "./calico.yaml": Get http://localhost:8080/api?timeout=32s: dial tcp [::1]:8080: connect: connection refused
unable to recognize "./calico.yaml": Get http://localhost:8080/api?timeout=32s: dial tcp [::1]:8080: connect: connection refused
unable to recognize "./calico.yaml": Get http://localhost:8080/api?timeout=32s: dial tcp [::1]:8080: connect: connection refused

我的api服务器运行在端口6443上。这就是我在kubeadm连接令牌中看到的由kubeadm init生成的。

有人能帮我纠正一下我的错误吗?除了192.168.0.0/16之外,还可以使用其他的网络掩码吗?我不能用它,因为它已经在我们的网络中使用了。

除了集群上的linux节点之外,我还想加入Windows节点。Calico网络是一种正确的方法还是推荐是另一回事。在初始化集群上的网络之前,我想知道,这样我就可以做正确的处理。

谢谢

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2019-11-22 21:05:34

在挣扎了几个小时之后,我发现kubectl应用命令需要作为常规用户而不是根用户运行。确保您正在为我们复制. .kube/config文件的用户执行该命令,否则在执行该命令后它将无法工作,我看到我的主程序已经准备好了。

票数 1
EN

Stack Overflow用户

发布于 2020-01-19 15:41:48

按照以下步骤克服这一问题:

代码语言:javascript
复制
mkdir -p $HOME/.kube

sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config

sudo chown $(id -u):$(id -g) $HOME/.kube/config
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58998354

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档