Unable to Access Internet from Within Pods #8499
-
Environmental Info: Node(s) CPU architecture, OS, and Version: Cluster Configuration: Describe the bug: Steps To Reproduce: This is where I've tried a lot of things based on research to resolve the problem:
Really I'm just out of ideas of what to try next, I've exhausted most avenues of my research at this point and could really use some informed guidance. Expected behavior: Actual behavior: Additional context / logs: |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 1 reply
-
You'll likely need to set HTTP_PROXY and HTTPS_PROXY vars in your Pod as environment variables. |
Beta Was this translation helpful? Give feedback.
-
In addition to configuring the http proxy environment variables in any pods that need to connect out to the Internet, you may also need to set up a resolv.conf for k3s that uses your corporate DNS servers as the resolvers, and configure k3s to use that via the --resolv-conf option. If k3s cannot find suitable upstream resolvers in your system configuration, it will default to using 8.8.8.8, which may be blocked in your environment. |
Beta Was this translation helpful? Give feedback.
-
How is this done exactly? I've seen on other issues in my research that people are using a mutating webhook to inject these variables? Is this really necessary or is there a built in way to set the proxy values at the pod level? Another issue mentions that it's not possible to set them at run time even though they're set in the k3s.service.env file, they don't get propagated to the pods. They say Kustomize or some other tool is required. I'll check on the resolv.conf file again and check out what my corporate DNS servers are if they're not already in there. Provided they're there on the node, how do I propagate those values to the pod as well as it's clearly utilizing a different resolv.conf file as the contents don't match? |
Beta Was this translation helpful? Give feedback.
-
Coming back to this. I've tried setting environment variables in my deployment. This sets the HTTP_PROXY and HTTPS_PROXY variables within the pod (I can echo them) however they are not actually being used when I try to do something like wget. It tries to access the URL directly instead of routing to the proxy specified. On the second response, my resolv.conf appears to be correct, but again the resolv.conf file within the pod points to just the coredns cluster IP and doesn't match anything outside in the cluster/node. Is there more to just setting the environment variables in the deployment? Do you happen to have any examples of how this works I can reference by chance? |
Beta Was this translation helpful? Give feedback.
-
For anyone coming back to this, the HTTP_PROXY, HTTPS_PROXY, and NO_PROXY environment variables are apparently case sensitive. You need to specify them as http_proxy, https_proxy, and no_proxy for them to work. |
Beta Was this translation helpful? Give feedback.
For anyone coming back to this, the HTTP_PROXY, HTTPS_PROXY, and NO_PROXY environment variables are apparently case sensitive. You need to specify them as http_proxy, https_proxy, and no_proxy for them to work.