Score:0

kvm instance network sometimes fail when use bridge, how to fix this?

to flag

my host and guests OS all are ubuntu server 22.04. bridge created by host use below netplan config, host and guest can reach each other. but when I use kubeadm init to init a k8s cluster, http request to guest itself sametimes timeout, so whole init will fail. how to fix this problem?

➜  /root cat /etc/netplan/01-netcfg.yaml
network:
  version: 2
  ethernets:
    enp5s0:
      dhcp4: false
      dhcp6: false
  bridges:
    br0:
      interfaces: [enp5s0]
      dhcp4: false
      dhcp6: false
      addresses: [192.168.101.20/24]
      routes:
        - to: default
          via: 192.168.101.1
          metric: 100
      nameservers:
        addresses: [192.168.101.1]
      mtu: 1500

I also enable below parameters for br_netfilter

vi /etc/sysctl.d/99-netfilter-bridge.conf
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.ip_forward = 1

some kubeadm log, we can see some request responsed well, but some timedout

I1010 10:17:41.644715    7039 round_trippers.go:473]     Accept: application/json, */*
I1010 10:17:41.736712    7039 round_trippers.go:574] Response Status: 422 Unprocessable Entity in 91 milliseconds
I1010 10:17:41.737253    7039 round_trippers.go:463] PUT https://192.168.101.24:6443/api/v1/namespaces/kube-system/services/kube-dns?timeout=10s
I1010 10:17:41.737267    7039 round_trippers.go:469] Request Headers:
I1010 10:17:41.737275    7039 round_trippers.go:473]     Accept: application/json, */*
I1010 10:17:41.737282    7039 round_trippers.go:473]     Content-Type: application/json
I1010 10:17:41.737288    7039 round_trippers.go:473]     User-Agent: kubeadm/v1.25.2 (linux/amd64) kubernetes/5835544
I1010 10:17:51.738173    7039 round_trippers.go:574] Response Status:  in 10000 milliseconds
Put "https://192.168.101.24:6443/api/v1/namespaces/kube-system/services/kube-dns?timeout=10s": net/http: request canceled (Client.Timeout exceeded while awaiting headers)
unable to create/update the DNS service
k8s.io/kubernetes/cmd/kubeadm/app/phases/addons/dns.createDNSService
        cmd/kubeadm/app/phases/addons/dns/dns.go:275
k8s.io/kubernetes/cmd/kubeadm/app/phases/addons/dns.createCoreDNSAddon
c4f4t0r avatar
nl flag
check if you have any iptables rules on the host.
xiedeacc avatar
to flag
no any iptables rules
xiedeacc avatar
to flag
kubeadm init success on physical machine
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.