kops icon indicating copy to clipboard operation
kops copied to clipboard

Random TCP timeouts when accessing a service (br_netfilter unloaded? )

Open TattiQ opened this issue 8 years ago • 9 comments

Dear Kops people,

Here it goes:

  1. What kops version are you running? The command kops version, will display this information. 1.8

  2. What Kubernetes version are you running? kubectl version will print the version if a cluster is running or provide the Kubernetes version specified as a kops flag. 1.7.12

  3. What cloud provider are you using? aws

  4. What commands did you run? What is the simplest way to reproduce this issue?

It turns out the br_netfilter module was not loaded on a kops node which caused random timeouts when one pod was trying to access a service. Both pods were residing on the same node.

from the source pod's logs it looked like this:

ConnectTimeout(MaxRetryError("HTTPConnectionPool(host='destination_svc', port=80): Max retries exceeded with url: /tasks (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x7f538247580>, 'Connection to destination_svc timed out. (connect timeout=15)'))",),)

Service was passing the request to the endpoint (pod cluster ip) but then there was a tcp reset.

  1. What happened after the commands executed?

  2. What did you expect to happen? I expect the br_netfilter to be loaded and some config management to make sure it stays loaded. We use flannel(vxlan) and cni plugin. Which part is responsible for loading the kernel modules? br_netfilter is a separate module since 3.18 kernel . All the other nodes did have the module loaded, so it happens at some point, but how could it be unloaded then (nothing particular in the node's logs regarding that) and how can we make sure the config on kops nodes is consistent?

  3. Please provide your cluster manifest. Execute kops get --name my.example.com -o yaml to display your cluster manifest. You may want to remove your cluster name and other sensitive information.

  4. Please run the commands with most verbose logging by adding the -v 10 flag. this looks related -> https://github.com/kubernetes/kops/issues/4323 .

  5. Anything else do we need to know? I noticed some people add a hook to the kops cluster config that loads the module . It is the way to do it ? Anything regarding that in kops documentation that I missed? If so, please point me to it. Since the br_netfilter has been loaded we do not experience this issues.

Thank you!

TattiQ avatar Jun 29 '18 12:06 TattiQ

@TattiQ

What AMI are you using for the nodes ? CoreOS ?

schweizerbolzonello avatar Jul 08 '18 16:07 schweizerbolzonello

Hi @schweizerbolzonello , sorry, I should've added that info, it's k8s-1.7-debian-jessie-amd64-hvm-ebs-2018-01-05 - ami-59821420 Kubernetes 1.7 Base Image - Debian jessie amd64 .

TattiQ avatar Jul 09 '18 06:07 TattiQ

I had br_netfilter unloaded/turned off on ubuntu 16.04 lts and things just did not start using k8s 1.10 or 1.11, forgot which

ms4720 avatar Jul 19 '18 02:07 ms4720

HI guys, experienced it again on a different kops cluster, also Debian jessie amd64 , kops 1.7.16.

TattiQ avatar Jul 23 '18 06:07 TattiQ

And yet again today in prod, experienced dns resolution issues due to the same issue. from k8s perspective the node in question was 22 days , as kubectl get nodes shows, but it's uptime was a couple of hours, so the node was rebooted for some reason and br_netfilter was not loaded.

log//kern.log:Aug 8 07:11:36 ip- kernel: [ 11.947780] ip_tables: (C) 2000-2006 Netfilter Core Team log//kern.log:Aug 8 07:11:43 ip- kernel: [ 19.385788] bridge: automatic filtering via arp/ip/ip6tables has been deprecated. Update your scripts to load br_netfilter if you need this. log//kern.log:Aug 8 07:11:50 ip- kernel: [ 26.761103] Netfilter messages via NETLINK v0.30.

As I see there is a PR related to fixing this in newer versions https://github.com/kubernetes/kops/pull/5490 . but what about mere mortals who run 1.7.X kubernetes...

TattiQ avatar Aug 08 '18 08:08 TattiQ

@oserman was totally right when he referenced this issue in https://github.com/cloudposse/docs/issues/194 suggesting it could be connected to dns issues, since the same can also manifest itself as a dns issue. as I see the guys have now this change https://github.com/kubernetes/kops/pull/5490/files . so this is being worked on. for now i will add this to the cluster spec -

  hooks:
  - before:
    - network-pre.target
    - kubelet.service
    manifest: |
      Type=oneshot
      ExecStart=/sbin/modprobe br_netfilter
      [Unit]
      Wants=network-pre.target
      [Install]
      WantedBy=multi-user.target
    name: fix-dns.service
    roles:
    - Node
    - Master

TattiQ avatar Aug 10 '18 08:08 TattiQ

closing since a found a solution for myself in the form of the above mentioned hook to make br_netfilter load before kubelet even starts.

TattiQ avatar Aug 10 '18 08:08 TattiQ

Do you force load netfilter on boot?

On Fri, Aug 10, 2018, 4:24 PM Tatyana Koroleva [email protected] wrote:

Closed #5393 https://github.com/kubernetes/kops/issues/5393.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kubernetes/kops/issues/5393#event-1781954485, or mute the thread https://github.com/notifications/unsubscribe-auth/AACRxax5naIg2P0P8q7z5tfe7wRwTMmaks5uPUNDgaJpZM4U87DQ .

ms4720 avatar Aug 10 '18 15:08 ms4720

yep! via a oneshot systemd unit. as I understood they plan to do the same here but by adding the module to a file under /etc/modules-load.d/ https://github.com/kubernetes/kops/pull/5490/files . e.g. https://www.freedesktop.org/software/systemd/man/modules-load.d.html

TattiQ avatar Aug 10 '18 15:08 TattiQ