windows icon indicating copy to clipboard operation
windows copied to clipboard

In Kubernetes, the network of Windows is unstable and web pages cannot be opened

Open geekopslc opened this issue 2 years ago • 5 comments

Operating system

ubuntu 24.04

Description

In Kubernetes, the network of Windows is unstable and web pages cannot be opened(www.baidu.com) ,Access to most websites in Windows fails except Bing,Windows even failed to download the language pack However, when using Docker Compose, it works fine.

And trying to ping the domain name has been smooth

bb

I deployed an http service listening on port 8080 in Windows, and other hosts in the LAN can access it smoothly.

uu ss

Docker compose

version: "3" services: windows: image: dockurr/windows build: . container_name: windows privileged: true environment: VERSION: "http://winiso/Win10.iso" MANUAL: "N" TPM: "N" DEBUG: "Y" ARGUMENTS: "-device vfio-pci,host=01:00.0,multifunction=on -device vfio-pci,host=01:00.1,multifunction=on -device usb-host,vendorid=0x1a2c,productid=0x6004 -device usb-host,vendorid=0x1c4f,productid=0x0034" RAM_SIZE: "4G" CPU_CORES: "4" DISK_SIZE: "64G" devices: - /dev/dri - /dev/kvm #- /dev/vfio/16 - /dev/bus/usb group_add: - "0" cap_add: - NET_ADMIN - SYS_ADMIN ports: - 8006:8006/tcp - 3389:3389/tcp - 8006:8006/udp volumes: - /root/cl/win:/storage depends_on: - winiso winiso: image: nginx:latest container_name: winiso restart: on-failure volumes: - /root/cl/iso:/usr/share/nginx/html

Docker log

docker compose up WARN[0000] /root/k8s/docker-compose.yml: the attribute version is obsolete, it will be ignored, please remove it to avoid potential confusion [+] Running 3/3 ✔ Network k8s_default Created 0.1s ✔ Container winiso Created 0.1s ✔ Container windows Created 0.0s Attaching to windows, winiso winiso | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration winiso | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/ winiso | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh winiso | 10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf winiso | 10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf winiso | /docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh winiso | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh winiso | /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh winiso | /docker-entrypoint.sh: Configuration complete; ready for start up winiso | 2024/10/03 11:26:13 [notice] 1#1: using the "epoll" event method winiso | 2024/10/03 11:26:13 [notice] 1#1: nginx/1.26.2 winiso | 2024/10/03 11:26:13 [notice] 1#1: built by gcc 13.2.1 20240309 (Alpine 13.2.1_git20240309) winiso | 2024/10/03 11:26:13 [notice] 1#1: OS: Linux 6.8.0-45-generic winiso | 2024/10/03 11:26:13 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576 winiso | 2024/10/03 11:26:13 [notice] 1#1: start worker processes winiso | 2024/10/03 11:26:13 [notice] 1#1: start worker process 30 winiso | 2024/10/03 11:26:13 [notice] 1#1: start worker process 31 winiso | 2024/10/03 11:26:13 [notice] 1#1: start worker process 32 winiso | 2024/10/03 11:26:13 [notice] 1#1: start worker process 33 winiso | 2024/10/03 11:26:13 [notice] 1#1: start worker process 34 winiso | 2024/10/03 11:26:13 [notice] 1#1: start worker process 35 winiso | 2024/10/03 11:26:13 [notice] 1#1: start worker process 36 winiso | 2024/10/03 11:26:13 [notice] 1#1: start worker process 37 winiso | 2024/10/03 11:26:13 [notice] 1#1: start worker process 38 winiso | 2024/10/03 11:26:13 [notice] 1#1: start worker process 39 winiso | 2024/10/03 11:26:13 [notice] 1#1: start worker process 40 winiso | 2024/10/03 11:26:13 [notice] 1#1: start worker process 41 windows | ❯ Starting Windows for Docker v0.0... windows | ❯ For support visit https://github.com/dockur/windows windows | ❯ CPU: 12th Gen Intel Core TM i5 12400 | RAM: 20/32 GB | DISK: 282 GB (ext4) | HOST: 6.8.0-45... windows | windows | ❯ Host: c11bc5790cc3 IP: 172.18.0.3 Gateway: 172.18.0.1 Interface: eth0 MAC: 02:CD:F5:DA:E8:80 windows | nameserver 127.0.0.11 windows | windows | Arguments: windows | windows | -nodefaults windows | -cpu host,kvm=on,l3-cache=on,+hypervisor,migratable=no,+invtsc,hv_passthrough windows | -smp 4,sockets=1,dies=1,cores=4,threads=1 windows | -m 4G windows | -machine type=q35,smm=on,graphics=off,vmport=off,dump-guest-core=off,hpet=off,accel=kvm windows | -enable-kvm windows | -global kvm-pit.lost_tick_policy=discard windows | -display vnc=:0,websocket=5700 windows | -vga virtio windows | -monitor telnet:localhost:7100,server,nowait,nodelay windows | -daemonize windows | -D /run/shm/qemu.log windows | -pidfile /run/shm/qemu.pid windows | -name windows,process=windows,debug-threads=on windows | -serial pty windows | -device qemu-xhci,id=xhci windows | -device usb-tablet windows | -netdev tap,id=hostnet0,ifname=qemu,vhost=on,vhostfd=40,script=no,downscript=no windows | -device virtio-net-pci,romfile=,netdev=hostnet0,mac=02:CD:F5:DA:E8:80,id=net0 windows | -drive file=/storage/Windows.iso,id=cdrom9,format=raw,cache=unsafe,readonly=on,media=cdrom,if=none windows | -device virtio-scsi-pci,id=cdrom9b,bus=pcie.0,addr=0x5,iothread=io2 windows | -device scsi-cd,drive=cdrom9,bus=cdrom9b.0,bootindex=9 windows | -drive file=/storage/data.img,id=data3,format=raw,cache=none,aio=native,discard=on,detect-zeroes=on,if=none windows | -device virtio-scsi-pci,id=data3b,bus=pcie.0,addr=0xa,iothread=io2 windows | -device scsi-hd,drive=data3,bus=data3b.0,channel=0,scsi-id=0,lun=0,rotation_rate=1,bootindex=3 windows | -object iothread,id=io2 windows | -rtc base=localtime windows | -global ICH9-LPC.disable_s3=1 windows | -global ICH9-LPC.disable_s4=1 windows | -global driver=cfi.pflash01,property=secure,value=on windows | -drive file=/storage/windows_secure.rom,if=pflash,unit=0,format=raw,readonly=on windows | -drive file=/storage/windows_secure.vars,if=pflash,unit=1,format=raw windows | -chardev socket,id=chrtpm,path=/run/swtpm-sock windows | -tpmdev emulator,id=tpm0,chardev=chrtpm windows | -device tpm-tis,tpmdev=tpm0 windows | -object rng-random,id=objrng0,filename=/dev/urandom windows | -device virtio-rng-pci,rng=objrng0,id=rng0,bus=pcie.0,addr=0x1c windows | -device vfio-pci,host=05:00.0,multifunction=on windows | -device vfio-pci,host=05:00.1,multifunction=on windows | ❯ Booting Windows securely using QEMU v9.0.2... windows |

BdsDxe: loading Boot0001 "UEFI QEMU QEMU HARDDISK " from PciRoot(0x0)/Pci(0xA,0x0)/Scsi(0x0,0x0) windows | BdsDxe: starting Boot0001 "UEFI QEMU QEMU HARDDISK " from PciRoot(0x0)/Pci(0xA,0x0)/Scsi(0x0,0x0) windows | ❯ Windows started succesfully, visit http://localhost:8006/ to view the screen..

Screenshots (optional)

k8s file:

apiVersion: apps/v1 kind: Deployment metadata: name: windows spec: replicas: 1 selector: matchLabels: app: windows template: metadata: labels: app: windows spec: containers: - name: windows image: dockurr/windows imagePullPolicy: IfNotPresent env: - name: VERSION value: "http://winiso/Win10.iso" - name: MANUAL value: "N" - name: TPM value: "N" - name: DEBUG value: "Y" - name: ARGUMENTS value: "-device vfio-pci,host=01:00.0,multifunction=on -device vfio-pci,host=01:00.1,multifunction=on" - name: RAM_SIZE value: "8G" - name: CPU_CORES value: "8" - name: DISK_SIZE value: "64G" securityContext: privileged: true ports: - name: port-8006 containerPort: 8006 - name: port-3389 containerPort: 3389 - name: port-8080 containerPort: 8080 volumeMounts: - mountPath: /storage name: storage-volume securityContext: privileged: true capabilities: add: - NET_ADMIN - SYS_ADMIN volumes: - name: storage-volume hostPath: path: /root/cl/win

apiVersion: v1 kind: Service metadata: name: windows-service spec: type: NodePort ports: - name: port-3389 port: 3389 targetPort: 3389 nodePort: 3389 - name: uport-3389 port: 3389 targetPort: 3389 nodePort: 3389 protocol: UDP - name: port-8080 port: 8080 targetPort: 8080 nodePort: 8080 - name: port-8006 port: 8006 targetPort: 8006 nodePort: 8006 - name: uport-8006 port: 8006 targetPort: 8006 nodePort: 8006 protocol: UDP selector: app: windows

geekopslc avatar Oct 03 '24 13:10 geekopslc

Very strange issue! For me it looks more if this is some bug in Kubernetes and not specifically in the container. But I have no clue to be honest..

kroese avatar Oct 05 '24 11:10 kroese

Okay, I've found the reason. It was because a service with NodePort was bound to the deployment in Kubernetes, which led to the traffic being load-balanced and diverted to the containers on other nodes.

geekopslc avatar Oct 08 '24 00:10 geekopslc

Hello @lcax200000, I encountered the same issue while deploying with Kubernetes. Could you explain your solution?

Bitlii avatar Dec 06 '24 06:12 Bitlii

Hello @lcax200000, I encountered the same issue while deploying with Kubernetes. Could you explain your solution?

The reason for the problem is that the MTU size notified by Windows to the other end is larger than the acceptable size of the k8s network component (flannel). My solution is to lower the MTU of Windows to the minimum acceptable value of the flannel virtual network device (1400->1350) or configure to reduce the forwarding path of flannel (host-gw mode)

geekopslc avatar Dec 07 '24 15:12 geekopslc

@lcax200000 This problem has been fixed now in v4.17

It now automaticly detects the correct MTU size and configures it in Windows so that it always works without you manually correcting it.

kroese avatar Mar 03 '25 11:03 kroese