skip to Main Content

I have a freshly created kubernetes cluster set on 2 nodes, both nodes are open to the internet. I can curl, ping etc. any web. The problem appear when I try to do the same from pod. eg.
curl to yoururl.com from node returns 200 and some response
the same curl from inside of alpine pod returns 301 Moved Permanently
The k8s network is managed by flannel. What bothers me is iptables Chain Forward that was added after k8s installation (screen below). Is this default behavior of flannel? Should I change it to ACCEPT policy? enter image description here

2

Answers


  1. If you are experiencing issues with accessing external websites from your pods, it is possible that your nodes are not configured to use the correct DNS server. You can try adding the following configuration to your pod’s YAML

    spec:   
        dnsPolicy: "Default"
    
    Login or Signup to reply.
  2. If you are getting 301 Status code, it means you have an internet connection and a working dns.
    try to ping the address from inside the container to see what IP is being resolved, then compare it to ping, done from your node.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search