No internet connectivity inside docker container running inside kubernetes with weave as networking

前端 未结 3 1527
执念已碎
执念已碎 2021-01-13 11:29

I have a kubernetes cluster that is running on AWS EC2 instances and weave as networking(cni). I have disabled the docker networking(ipmask and iptables) as it is managed by

3条回答
  •  借酒劲吻你
    2021-01-13 12:07

    Ok finally after lot of struggle I find the solution.
    So when ever K8s starts a pod it starts a sidecart container whose role is basically to provide network to pod containers.
    So while running docker build if I pass it's container ID as network then my intermediate contexts start getting internet connectivity via this container. So changes looks something like this:

    docker build -t "some name" --network container:\$(docker ps | grep \$(hostname) | grep k8s_POD | cut -d\" \" -f1) -f infra/docker/Dockerfile .
    

    Hope this helps. :D

提交回复
热议问题