1

I have a Kubernetes pod based on a Jenkins/slave container to which I mount a Docker socket and a Docker binary file with necessary kernel modules in privileged mode.

Inside that pod I build a Docker image, in which I run Docker container. Inside that container I don't have Internet connection at all because the pod container uses a flannel network (198.x.x.x) and that container uses bridged docker network (172.x.x.x), which is not available inside the pod container.

How can I make the Internet available inside the second container which is being created inside the Kubernetes pod container?

Using Docker API in Jenkins pipeline is not a solution for me as long as it limits output of error logs and I can not commit changes made in the second container because of immediate removing of that container after build.

  • I have a similar problem, I don’t have access to the external network from the Pod. How did you resolve iptables conflict? – khesl Mar 26 at 3:41
1

In my opinion k8s should not be used to build docker images as it is an orchestration platform, but there is an open issue in the GitHub k8s repository. In conclusion, building docker images on a k8s cluster seems not to be possible at the moment.

  • I was able to resolve it long ago. There was an issue with iptables rules because of conflicts with flannel interface. As a result rules for docker0 bridge interface were not applied correctly after each server reboot. Now everything is being worked properly. Thank you! – user54 Dec 2 '17 at 12:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.