flannel-io / flannel

flannel is a network fabric for containers, designed for Kubernetes
Apache License 2.0
8.83k stars 2.87k forks source link

--iface Dose nothing #1119

Closed csafg2 closed 5 years ago

csafg2 commented 5 years ago

Manually setting --iface=enp0s8 in kube-flannel seems to be totally ignored.

      containers:
      - name: kube-flannel
        image: quay.io/coreos/flannel:v0.11.0-s390x
        command:
        - /opt/bin/flanneld
        args:
        - --ip-masq
        - --kube-subnet-mgr
        - --iface=enp0s8

kubectl apply -f flannel.yaml reports everything as OK. however when looking at logs flannel is still using default interface.

Pears@node1:~$ kubectl logs pod/kube-flannel-ds-amd64-hrgdl | grep interface
I0401 07:43:11.961053       1 main.go:514] Determining IP address of default interface
I0401 07:43:12.237615       1 main.go:527] Using interface with name enp0s3 and address 10.0.2.15

Expected Behavior

enp0s8 interface should be used.

Current Behavior

Always uses the default interface.

Context

I realized this issue when trying to setup a service with ExtranalTrafficPolicy set to cluster. and my pods were responding only on nodes where that specific pod is present

Your Environment

csafg2 commented 5 years ago

My bad, it seems that kube-flannel is configured multiple times in that deployment file. so you need to pass the argument to all of them.

Amirilw commented 5 years ago

i did configure it at all places, still not working for me , have any advice ?


apiVersion: policy/v1beta1 kind: PodSecurityPolicy metadata: name: psp.flannel.unprivileged annotations: seccomp.security.alpha.kubernetes.io/allowedProfileNames: docker/default seccomp.security.alpha.kubernetes.io/defaultProfileName: docker/default apparmor.security.beta.kubernetes.io/allowedProfileNames: runtime/default apparmor.security.beta.kubernetes.io/defaultProfileName: runtime/default spec: privileged: false volumes:

haanyip commented 4 years ago

not work + 1

haanyip commented 4 years ago

i finally solved it! just add - --iface={your_iface_name} for every node of "args"

timyl commented 4 years ago

add this args to all Daemonset and it works for me [root@k8s-master01 ~]# bridge fdb show dev flannel.1 a2:05:9f:ac:40:da dst 192.168.56.103 self permanent 0e:22:e2:f3:09:04 dst 192.168.56.103 self permanent ce:cf:6f:d7:c9:4c dst 192.168.56.102 self permanent 8e:32:8d:27:ac:9a dst 192.168.56.102 self permanent

ysyyork commented 3 years ago

To be specific, I added multiple DaemonSet into the kube-flannel.yml and used a node selector to select the specific node with the specific iface name.