Kubernetes: Pods Can't Resolve Hostnames

前端 未结 4 1203
忘掉有多难
忘掉有多难 2021-02-05 21:40

I am encountering an issue with Kubernetes where my pods cannot resolve hostnames (such as google.com or kubernetes.default).

I currently have

4条回答
  •  长情又很酷
    2021-02-05 22:31

    Check coredns pods log, if you see errors like:

    # kubectl logs --namespace=kube-system coredns-XXX
      ...
      [ERROR] plugin/errors ... HINFO: read udp ... read: no route to host
    

    Then make sure firewalld masquerade is enabled on the host:

    # firewall-cmd --list-all
      ... 
      masquerade: yes
    
    Enable if it's "no":
    # firewall-cmd --add-masquerade --permanent
    # firewall-cmd --reload
    

    *You may need to restart/reboot after this

提交回复
热议问题