kubernetes: "kubectl top nodes" reports "unknown" when executing multiple concurrent “kubectl exec” requests against a pod running on a Windows node

What happened?

“kubectl top nodes” reports “unknown” when executing multiple concurrent “kubectl exec” requests against a pod

What did you expect to happen?

“kubectl top nodes” reports the status of nodes.

How can we reproduce it (as minimally and precisely as possible)?

  1. create an AKS Windows node akswin22000000.
  2. deploy a pod to this node with this yaml (kubectl apply -f hpc.yaml):
apiVersion: v1
kind: Pod
metadata:
  labels:
    pod: hpc
  name: hpc
spec:
  securityContext:
    windowsOptions:
      hostProcess: true
      runAsUserName: "NT AUTHORITY\\SYSTEM"
  hostNetwork: true
  containers:
    - name: test
      image: mcr.microsoft.com/windows/servercore:ltsc2022
      imagePullPolicy: IfNotPresent
      command:
        - powershell.exe
        - -Command
        - "Start-Sleep 2147483"
  nodeSelector:
    kubernetes.io/hostname: "akswin22000000"
  1. run the following script (test.py) and wait for several minutes.
import subprocess
import threading

def run_command(pod_name, command):
  subprocess.run(["kubectl", "exec", pod_name, "--", "powershell", "-command", command])

threads = []
for i in range(0, 50):
  thread = threading.Thread(target=run_command, args=("hpc", "& { Start-Sleep 0 }"))
  thread.start()
  threads.append(thread)

for thread in threads:
  thread.join()
  1. run kubectl top nodes and get the following result:
NAME                                CPU(cores)   CPU%        MEMORY(bytes)   MEMORY% 
aks-nodepool1-66451635-vmss000000   170m         8%          1877Mi          41%  
akswin22000000                      <unknown>    <unknown>   <unknown>       <unknown> 

Anything else we need to know?

Restarting node can recover it.

But we still have the following questions:

  1. Why is “kubectl exec” causing problems? This looks like a bug: if the API is not designed to handle some load, we expect it to return an error, not hang.
  2. Why is the node not recovering its metrics, even after the “hanging” pod is restarted?

Kubernetes version

$ kubectl version
# paste output here

Client Version: version.Info{Major:“1”, Minor:“27+”, GitVersion:“v1.27.1-eks-2f008fe”, GitCommit:“abfec7d7e55d56346a5259c9379dea9f56ba2926”, GitTreeState:“clean”, BuildDate:“2023-04-14T20:43:13Z”, GoVersion:“go1.20.3”, Compiler:“gc”, Platform:“linux/amd64”} Kustomize Version: v5.0.1 Server Version: version.Info{Major:“1”, Minor:“28”, GitVersion:“v1.28.3”, GitCommit:“5214c5ddb5785ed9d8e47e79e67181e205555067”, GitTreeState:“clean”, BuildDate:“2024-04-12T23:22:53Z”, GoVersion:“go1.20.10”, Compiler:“gc”, Platform:“linux/amd64”}

Cloud provider

AKS

OS version

# On Linux:
$ cat /etc/os-release
# paste output here
$ uname -a
# paste output here

# On Windows:
C:\> wmic os get Caption, Version, BuildNumber, OSArchitecture
# paste output here

Install tools

Container runtime (CRI) and version (if applicable)

Related plugins (CNI, CSI, …) and versions (if applicable)

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15 (7 by maintainers)

Most upvoted comments

I think we haven’t used containerd v1.7.17 in AKS now. So we can wait for the containerd v1.7.17 that has the fix and validate it later.