簡體   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