繁体   English   中英

如何将 Pod 连接到互联网? [K8S]

[英]How to connect a pod to internet ? [K8S]

  1. 我安装了 Kubernetes “kubeadm 方式”
  2. 我加入了两个节点

当我运行 nginx 吊舱然后尝试 curl www.google.com失败。

$ kubectl exec -it nginx -- sh 
# curl http://google.com
'curl: (6) Could not resolve host: google.com

我该如何解决这个问题?

  • 我在主节点和工作节点上禁用了防火墙
  • 我在公司代理后面运行 K8S
  • 我将 Api 服务器的 ip 地址添加到 NO_PROXY 列表(在主节点和工作节点上)
  • 我将工作节点的 ip 地址添加到 NO_PROXY 列表(在主节点上)

cni 配置:

    "cniVersion": "0.3.1",
    "name": "crio",
    "type": "bridge",
    "bridge": "cni0",
    "isGateway": true,
    "ipMasq": true,
    "hairpinMode": true,
    "ipam": {
        "type": "host-local",
        "routes": [
            { "dst": "0.0.0.0/0" },
            { "dst": "1100:200::1/24" }
        ],
        "ranges": [
            [{ "subnet": "10.85.0.0/16" }],
            [{ "subnet": "1100:200::/24" }]
        ]
    }
}

When I run nginx container with podman then try to execute a curl within the container: $ curl http://google.com (timeout)

尝试这个:

  1. 通过运行kubeadm reset删除集群
  2. 删除/opt/bni/bin/weave-*
  3. 在通过kubeadm init创建新集群之前重新启动机器。

看起来像以下问题:

https://github.com/weaveworks/weave/issues/2888

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM