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
kubernetes proxy iptables rules lost after restarting iptables+node #1922
Comments
So, the interesting thing is that when I actually rebooted the node, the rules came back. However, restarting a node host that is also a master definitely does not result in getting the iptables rules back. So I think there may be an issue with service ordering / start order when it comes to successfully getting the iptables rules back, and I think it may manifest on nodes that are running master... |
Here's what I'm seeing in my 1 master / 3 node environment:
The iptables rules come back quickly and I can curl a service that has a pod running on that node. However, my other nodes haven't picked up the change after 5 minutes or so. I then did a clean reboot off all the VMs and 2 of the Nodes came up with the kube-proxy working as expected. I'm still waiting on the 3rd though. It's running the pods as expected but none of the kube-proxy nat'ing was set up after waiting several minutes. Forcefully restarting openshift-node caused the nat'ing to be reloaded and things worked as expected. I think there are at least two problems here:
|
In my environment it definitely seems that if I don't restart |
@thoraxe, could you see if you are able to reproduce what I'm seeing:
If I run that all other Nodes will be able to access the registry via the Service IP a few seconds after those commands finish. FWIW, I also did an OS reboot again and all the services came up correctly this time. I'll have to keep looking in to this problem. |
Looking at logs when this fails, I suspect that openshift-sdn-node is altering iptables rules at roughly the same time that openshift-node is attempting to do so. We should alter both k8s and openshift-sdn-node to use iptables -w and add re-try logic as -w will immediately return an error if it can't get a lock. Here's the logs that lead me to believe it's a contention issue between the two
So, at minimum there's 661ms and at most 1.661s between the time openshift-sdn-node last issued an iptables command and openshift-node attempts to provision the proxies. Given this is happening after a reboot the system may be busy with other things and take longer than expected to commit iptables rules. @smarterclayton should we file an upstream k8s issue? While openshift-sdn-node may be exacerbating the situation here, there may be a number of other scenarios where an external process is altering iptables rules and we should -w and retry, (ie: puppet runs, etc). openshift-sdn-node doesn't contain the sdNotify stuff that allow it to signal when it's completed its start up, we should probably add that, it may help the situation but it's not the solution. |
Ok, so everyone should be using -w then. We should have two issues, one for kube and one for openshift-sdn. We can repurpose this one for openshift-sdn and assign to @rajatchopra, can you file the upstream? ----- Original Message -----
|
@sdodson, I think it's correct to say that with using '-w' (which all distros might not have) we need to have a reasonable default timeout. I think we'd still want retry logic as well if it wasn't too messy. @smarterclayton, would you want retry logic added? |
FWIW, I am putting together the code so that openshift-sdn will run as a go routine inside openshift-node, so we can event this stuff easily if we want certain order to be enforced. |
Let's have the retry discussion upstream for the kube-proxy (for any go code). Retry on ansible etc seems like we'd potentially have races as well. ----- Original Message -----
|
@thoraxe, I think we can close this now. We're tracking the iptables locking race condition upstream. |
Effectively restarting iptables and then openshift-node is like rebooting the node host.
This gist contains some relevant information:
https://gist.github.com/thoraxe/a875b22f42051d64c267
Essentially, I am seeing that iptables rules are not re-initialized on my node hosts, specifically those related to kubernetes proxying.
I think this is kind of related to #1089 except that I am not having any issue reaching Docker containers over the SDN.
I'm not sure if this is a "wait for a minute" kind of thing, but it's been more than a minute or two since I restarted the node (~ 3 minutes) and the iptables rules have not reappeared.
Should I be opening this issue upstream (kubernetes)?
The text was updated successfully, but these errors were encountered: