-
Notifications
You must be signed in to change notification settings - Fork 280
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
ipv6 + Calico + out of tree cloud-provider is broken #3401
Comments
/assign @lzhecheng |
The error is invalid Pod IPs, which doesn't seem to be related to ccm/kcm. But let's check the logs why there was duplicated IPs in pod status. |
I agree it doesn't seem related to ccm, I think it might have to do with Calico somehow, but the weird thing is, I can't reproduce this error with the exact same template (Calico CNI too) when clou-provider is "azure" but as soon as I switch cloud-provider to "external" and install CCM I can repro easily. |
I created a cluster with 1) CAPZ of your branch (oot-templates); 2) templates/cluster-template-ipv6.yaml; 3) ci-entrypoint.sh. The cluster looks good. Could you please share how to reproduce locally?
|
@lzhecheng in my experience this doesn't repro every time but chances of reproing are a lot higher with 3+ control planes. I am usually able to repro easily within the first 4-5 clusters built. |
This time I created clusters with 3 control-plane nodes, for 3 times. They all look good. Is the problem still there? |
@lzhecheng yes, see kubernetes-sigs/cluster-api-provider-azure#3221, e2e test failed ipv6 scenario: https://prow.k8s.io/view/gs/kubernetes-jenkins/pr-logs/pull/kubernetes-sigs_cluster-api-provider-azure/3221/pull-cluster-api-provider-azure-e2e/1631444499202838528 The only change compared to kubernetes-sigs/cluster-api-provider-azure#3105 where e2e test is passing for ipv6 is kubernetes-sigs/cluster-api-provider-azure@e3701e0 |
Update: I observed such issue locally as well.
|
@lzhecheng you're right this was a different error on the worker node because I forgot to add back the "external" cloud-provider configuration on the worker node kubelet config (fixed in kubernetes-sigs/cluster-api-provider-azure@051ae83) Now that it's fixed, it is still failing and this time repro'ing the same issue (on the first try) I was seeing before where 1 of the control planes has a pending pod for one of the k8s components, in this case it's the second control plane's scheduler pod: https://storage.googleapis.com/kubernetes-jenkins/pr-logs/pull/kubernetes-sigs_cluster-api-provider-azure/3221/pull-cluster-api-provider-azure-e2e/1631738500053209088/artifacts/clusters/bootstrap/resources/capz-e2e-6l4j4b/Machine/capz-e2e-6l4j4b-ipv6-control-plane-m8ktt.yaml in the kubelet log on that VM, we can see
|
@CecileRobertMichon thank you for the fix. |
@lzhecheng the 3rd control plane node is not coming up because of the "invalid pod IPs" issue in the 2nd control plane: Cluster API checks the health of all control plane components before scaling up and in this case the check is failing because the scheduler pod is not healthy |
@CecileRobertMichon Update: I ran
Here
|
I just rebased the PR so it now only has the diff for switching ipv6. Running the job again then will disable everything but ipv6 in a test commit and run that. |
Update: Reproduced on a manually created cluster, restarting these static manifest Pods will get recovered. |
@CecileRobertMichon is it possible I can create a cluster with a kubelet binary built locally by myself? kubelet seems to update Pod status with unexpected host IPs and I'd like to add logs to check it. |
@lzhecheng yes but you'll need to create a template based on the custom-builds.yaml template that uses out of tree + ipv6 (that's not a combination of features we have in the templates in the repo unfortunately): https://capz.sigs.k8s.io/developers/kubernetes-developers.html#kubernetes-117 |
Update: |
Root cause: kubelet always adds the second host IP into
https://github.com/kubernetes/kubernetes/blob/v1.25.6/pkg/kubelet/kubelet_pods.go#L1534-L1544
The fix: Check IP family before adding the IP into Why after switching to OOT cloud-provider-azure, the problem appears: |
Would it be possible to switch the order in out of tree cloud-provider too so the order is consistent with in tree cloud-provider? |
Yes, I am also working on it. |
@CecileRobertMichon this is the PR to fix the order issue in cloud-provider-azure code: #3643 cloud-provider-azure/pkg/provider/azure_instances.go Lines 127 to 152 in cdd5003
I want to add logic there to avoid reorder later. So, here's the question: Is it the process same for dualstack and IPv6 to add addresses to network interface? IPv6 cluster is IPv6 first then IPv4. Is dualstack cluster IPv4 first then IPv6? If so, we have to use my fix above. If not, means the process is the same, then as long as we have 2 internal IPs, we can always put IPv6 first. |
I don't know the answer to this. Maybe @aramase does? Edit: I just realized you meant in CAPZ. For network interfaces, it looks like IPv4 is always first: https://github.com/kubernetes-sigs/cluster-api-provider-azure/blob/main/azure/services/networkinterfaces/spec.go#L201
where do you see this? |
@CecileRobertMichon it is interesting. According to logs in CNM, IPv6 comes first and then the IPv4. These IPs comes from instance metadata.
I am not familiar with the CAPZ code, but is it possible |
This sounds like a similar symptom that we discovered when using secondary IPs w/ Azure CNI. |
No, we always add the ipv4 ip config as the primary IP: https://github.com/kubernetes-sigs/cluster-api-provider-azure/blob/main/azure/services/networkinterfaces/spec.go#L151 |
If there's the case, I think IMDS is not working properly. |
From CNM, it gets host IPs with |
@lzhecheng is kubelet configuring the --node-ip address in these clusters? because if that is the case, the controller must return the node.status.addresses in the same order as the --node-ip family |
Here is an example of a dual-stack cluster node: On the Azure portal the NIC shows the ipv4 address first on the NIC: And same thing in node addresses:
And here is an ipv6 single stack cluster: But note that this time the ipv6 address shows up first in the node IPs:
|
For the ipv6 cluster, kubelet For the dual stack cluster, it is not set (assuming it is getting defaulted) |
Maybe for IPv6, |
Let me try without it. cc @aramase |
@CecileRobertMichon @lzhecheng please check https://github.com/kubernetes/enhancements/tree/master/keps/sig-network/3705-cloud-node-ips , this is WIP and a known and complicated problem, we also have some ammends because of the complexity kubernetes/enhancements#3898 Please check the KEP to see if you are case is contemplated and if not, please let us know |
update: the e2e test passed several times in a row when node-ip is not set kubernetes-sigs/cluster-api-provider-azure#3221 |
Glad to know that. I think CNM doesn't need to change because as you said, IPv4 first and then IPv6 is the expected behaviour for CAPZ dualstack and IPv6 only. |
kubernetes-sigs/cluster-api-provider-azure#3221 is ready for review/merge |
/close |
@lzhecheng: Closing this issue. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
While moving all CAPZ templates to out-of-tree CCM, I was not able to get a reliably passing test for ipv6. This test is very flaky (it fails most of the time). Looking into it I found that the error is that kubelet can't patch the status of one of the kube-system pods (sometimes kube-apiserver, sometimes kube-scheduler, sometimes kube-controller-manager). One example of the error can be seen here. The error is
The same error does not repro with the in-tree cloud-provider (see passing ipv6 test with CAPZ and in-tree cloud-provider here).
The cloud-provider-azure test for ipv6 is also failing (although the failure is different: https://testgrid.k8s.io/provider-azure-cloud-provider-azure#cloud-provider-azure-master-ipv6-capz)
The text was updated successfully, but these errors were encountered: