How to turn off IP Masquerade in flannel

China☆狼群 提交于 2019-12-11 08:26:11

问题


In my Kubernetes cluster I couldn't connect to the internet from my Containers. So after searching, I found a possible solution, that is to turn off "IP Masquerade". But I had no luck turning this off. Whatever I did I cannot get it disabled.

First I change the following,

/etc/kubernetes/cni/docker_opts_cni.env

DOCKER_OPT_BIP=""
DOCKER_OPT_IPMASQ="false"

Then tried

/etc/kubernetes/cni/docker_opts_cni.env

DOCKER_OPT_BIP=""
DOCKER_OPT_IPMASQ="--ip-masq=false"

I'm using the latest Kubernetes version(v 1.6.3) and I have followed this to configure my cluster. I'm using flannel without calico. Can someone guide me on how I can get this disabled? Thanks in advance/


回答1:


This is an example configuration for creating new flannel network using cni for docker.

/etc/kubernetes/cni/net.d/10-flannel.conf

{
    "cniVersion": "0.2.0",
    "name": "mybridge",
    "type": "bridge",
    "bridge": "cni_bridge1",
    "isGateway": true,
    "ipMasq": true,
    "ipam": {
        "type": "host-local",
        "subnet": "10.15.30.0/24",
        "routes": [
            { "dst": "0.0.0.0/0" },
            { "dst": "1.1.1.1/32", "gw":"10.15.30.1"}
        ],
        "rangeStart": "10.15.30.100",
        "rangeEnd": "10.15.30.200",
        "gateway": "10.15.30.99"
    }
}

In your configuration file changing ipMasq value for true to false or adding the option if not present should turn off "IP Masquerade"




回答2:


Just a clarification, by flannel with calico do you mean canal ?

If so there is an option to flip in the configuration here.



来源:https://stackoverflow.com/questions/44119425/how-to-turn-off-ip-masquerade-in-flannel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!