-
Notifications
You must be signed in to change notification settings - Fork 40.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PodSpec.hostAliases has a potentially misleading comment about hostNetwork #122420
Comments
/sig node network cluster-lifecycle |
as reported by @chrischdi the hostAliases sometimes are not mounted for hostNetwork static pods, which is concerning: |
At minimum the comment is wrong I need to be updated and we need e2e tests :/ |
found this, support was added a while back: i will PR the API docs. |
We identified an edge case here with Kubernetes v1.29. If a cloud provider did not yet initialise the node's To be concrete, in: kubernetes/pkg/kubelet/kubelet_pods.go Line 160 in 3f7a50f
I was able to trace it back to this change which leads to this behaviour for static pods: For confirmation: I reverted the above commit, rebuilt kubelet and it got back to the old behaviour. |
there is no perfect solution, but reverting is wrong because opens another bug, we need to study this more carefully but in the meantime installers that know the nodes addresses beforehand should set the --node-ip flag or not use cloud-provider external |
yeah, as i mentioned downstream, revering #121028 is out of the question. it fixes some long standing problems. we might have to document somewhere this limitation in a cloud provider env. |
i think it might be possible for us to special case this so that the hostAlias management does not wait for the node IP in a CP env, under certain conditions. just a speculation. |
/triage accepted looks like it is being worked on already |
What happened?
there is a note above hostAliases that this feature does not work with hostNework=true, yet it seems it does:
https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/api/core/v1/types.go#L3672-L3679
when testing with a hostNetwork pod + hostAliases, there are no errors in kubelet logs at --v=10 related to this, in fact i don't see any hostAlias entries at all in there.
i could not find anything blocking this in the kubelet, in fact there is normal handling of hostNetwork:
https://github.com/kubernetes/kubernetes/blob/master/pkg/kubelet/kubelet_pods.go#L330
i could not find any validation performed on the hostAliases field of PodSpec if hostNetwork is true on the API level.
kubernetes/pkg/apis/core/validation/validation.go
Line 3888 in 38f4f9d
i could not find any unit tests or e2e tests related to this.
What did you expect to happen?
How can we reproduce it (as minimally and precisely as possible)?
these steps confirm that a static pod with hostNework (deployed by kubeadm) does make use of hostAliases.
kubeadm init
or one withkind create cluster
/etc/kubernetes/manifests/kube-apiserver.yaml
to include:Anything else we need to know?
n/a
Kubernetes version
latest master 1.30.0-alpha.0
Cloud provider
not applicable
OS version
Install tools
kubeadm
Container runtime (CRI) and version (if applicable)
containerd github.com/containerd/containerd v1.6.14 9ba4b250366a5ddde94bb7c9d1def331423aa323
Related plugins (CNI, CSI, ...) and versions (if applicable)
kindnet
Changes
add test:
test/e2e: add kubelet test for hostAliases with hostNetwork=true #122423
update godoc:
core/v1: remove note about hostAliases not working with hostNetwork #122422
The text was updated successfully, but these errors were encountered: