Commit aad0c01
authored
fix(containerd): skip dangling-pod check when kubelet read-only port … (#1241)
…is closed
The containerd component unconditionally calls
ListPodsFromKubeletReadOnlyPort against http://localhost:10255 to
cross-check sandboxes against kubelet's pod list, producing a recurring
connection-refused error log on every node where the kubelet
readOnlyPort is disabled (the kubeadm/CIS-hardened default).
Gate the call on netutil.IsPortOpen, matching the pattern the kubelet
component already uses (components/kubelet/component.go). When the port
is closed the dangling-pod check is skipped (danglingCount stays 0) and
the rest of the containerd checks proceed normally.
Example of error:
```May 07 11:58:00 cluster-node-2 gpud[3478]: {"level":"error","ts":"2026-05-07T11:58:00.933Z","caller":"log/log.go:183","msg":"error listing pods from kubelet: Get \"http://localhost:10255/pods\": dial tcp [::1]:10255: connect: connection refused","stacktrace":"github.com/leptonai/gpud/pkg/log.(*gpudLogger).Errorf\n\t/home/runner/work/gpud/gpud/pkg/log/log.go:183\ngithub.com/leptonai/gpud/components/containerd.(*component).Check\n\t/home/runner/work/gpud/gpud/components/containerd/component.go:306\ngithub.com/leptonai/gpud/components/containerd.(*component).Start.func1\n\t/home/runner/work/gpud/gpud/components/containerd/component.go:135"}
May 07 11:59:00 eden1-2 gpud[3478]: {"level":"error","ts":"2026-05-07T11:59:00.935Z","caller":"log/log.go:183","msg":"error listing pods from kubelet: Get \"http://localhost:10255/pods\": dial tcp [::1]:10255: connect: connection refused","stacktrace":"github.com/leptonai/gpud/pkg/log.(*gpudLogger).Errorf\n\t/home/runner/work/gpud/gpud/pkg/log/log.go:183\ngithub.com/leptonai/gpud/components/containerd.(*component).Check\n\t/home/runner/work/gpud/gpud/components/contai
```
With
```
$ gpud --version
gpud version v0.11.4
```
draft reason:
- [ ] And as I'm writing this I haven't tried a binary built with this
PR to see that it behaves differently.1 parent 0451b5f commit aad0c01
1 file changed
Lines changed: 11 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
299 | 300 | | |
300 | 301 | | |
301 | 302 | | |
302 | | - | |
303 | | - | |
304 | | - | |
305 | | - | |
306 | | - | |
307 | | - | |
308 | | - | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
309 | 313 | | |
310 | 314 | | |
311 | 315 | | |
| |||
0 commit comments