Code change:
Currently a Docker bug may cause KubeProxy to crashloop thus making the Node unable to use cluster network, which in turn makes Pods scheduled on this Node unreachable. To mitigate this issue we need to surface the information about problems with KubeProxy, that will allow scheduler to ignore given node when scheduling new Pods. ProblemAPI is going to address this kind of problems in the future, but we need a fix for the 1.3. Either Kubelet or KubeProxy needs to update a NodeStatus with the information that Node networking is down. I suggests that we reuse NodeReady Condition for this, as this would make the rest of ControlPlane work out of the box. We will replace this fix with the ProblemAPI use in the future. Another option, which requires more work, is creating a completely new NodeCondition type to handle this case. This would require making Scheduler aware of this new Condition.
Does kubelet monitor kube-proxy health?
Kube-proxy today runs as a static pod (daemonset), kubelet treats it the same as other static pods. Yes, Kubelet reports kube-proxy podstatus back to master, that is all. The detail information on kube-proxy is in crashloop at
cc/ Brandon, this issue explains my long position against running kubelet, kube-proxy, etc. critical daemons as docker container. I am ok to packaging them into docker image, and running as linux containers, but they shouldn't depend on docker daemon.
I think we don't want to run them as docker containers as well, we want to run them as rkt containers.
The initial proposal I reviewed was docker container, and I did raise my concerns to and coreos developers then. Running it as rkt container should be ok since rkt is daemon-less today, and shouldn't have this chicken egg issue at the first place. But we still have the problem on the nodes without rkt as runtime. At the meeting, I suggested that kube-proxy update NodeStatus with a newly introduced NodeCondition, like what we plan to do with kernel issue at: The reason of not using NodeReady is that kubelet might override that. Another very hacky way is before crashing, Kube-proxy logs the read-only filesystem problem somewhere, like /var/lib/kube-proxy/... Kubelet will pick up the information, then update NodeReady Condition with detail error message prefixing with "kube-proxy:" kube-proxy's responsibility to make the information up-to-date.
Can I have more description of the bug? Is there a related docker issue? Is there a repro? Does this only affect kube-proxy or will it affect other pods on the node? We need to support running critical applications (including system daemons) in pods in order to allow easy deployment and integration with vendors (e.g. storage and network vendors). cc since we were just talking about integrating through addons. What features are we missing that we can't support this right now? Is it just that our default container runtime is buggy and flaky and unreliable? Do we need the NodeProblem API? Do we need taints/tolerations?
- I don't know about any way to repro it other than running huge clusters. Pretty much every run of a 1000 Node cluster has this problem on at least one Node.
If you want to know the detail, see It is a docker issue, and pretty rare.
Can we regroup on this issue this week? Like tomorrow? , Dawn Chen wrote:
I will happily make kube-proxy write to or offer up pretty much any API we deem necessary to detect this issue. To me it still feels like a docker health-check suite is needed, and one of the tests is that sysfs gets mounted rw. BUt in the mean time, how about this: make be the API. Any component which feels that it has a node problem can write a JSON file into that directory. For this case, kube-proxy would write a file: Kubelet can turn that into Node status reports. , Tim Hockin wrote:
cc
PR of introducing NodeProblemDetector was merged last week, and the pr to enable it by default for Kubernetes cluster was merged over the weekend. So far everything works fine. Even it is an alpha feature, GKE folks agreed to enable it for GKE. To workaround this particular issue before we have proper docker fix, we can easily extend today's KernelMonitor module of NodeProblemDetector to monitor kube-proxy log, and report a new NodeCondition called SysfsReadonly to the issue visible. But we don't have remedy system yet, and pr of converting node problem (events, conditions etc.) to taints is still under the debate / review: 1) Should NodeController respect this new Condition, and simply mark node NotReady? 2) Should repair system pickup this issue, and restart docker?
Do we still observe the problem with docker 1.11.X? If no, I want to close this; otherwise, we are going to reconfigure NodeProblemDetector to make the issue visible.
cc/
Agree, I'd love to not "fix" this..
I think we've seen it the day before yesterday during our tests - can you please confirm?
I can't recall - we certainly did saw some failed nodes during the test, but I'm not sure we made sure it was a kube-proxy issue.
But what I can tell for sure that it's definitely less frequent - we started 2000-node cluster 10+ times during this week and we've seen it at most once (which makes it at least 99.995% reliable).
Not enough data. GKE is still deploying the old ContainerVM and isn't running Docker 1.11.1 yet, unless I'm mistaken.
aah ok - I didn't know that...
I'm going to tentatively close this until we show that it's a problem on Docker 1.11.2, now that Docker 1.11.2 is in on both GCE and GKE.
(Obviously feel free to reopen if I'm wrong.)
Another occurrence:
So it's still happening, can we teach NPD to detect and surface this as node unschedulable?
Yes, we can. But I found that the error only occurred once with docker 1.11 till now. At least, this should be a known issue, right? XRef Do we want to fix this in 1.3 or just claim known issues in release notes? :)
Doesn't this render the node unusable (i.e no services will work because kube-proxy is broken)? if so, we should surface regardless of frequency IMO. Whether we fix or paper over it is a different issue.
+1
Because it's code freeze now, I can add a temporary short hack in node problem detector to detect this issue. Should we do that? :)
Removed the priority and it back to 1.3 milestone, so that we can discuss at burndown meeting.
Yeah i think codefreeze just means no features
It is very rare after we upgrade to docker 1.11.X. To extend KernelMontor in NodeProblemDetector to detect the issue is totally overkill, since we have to allocate more compute resource to NodeProblemDetector to process tons of kube-proxy logs. Here is what I suggested for this issue for 1.3 and 1.4+: Document this as known issue for docker releases: docker 1.10.X (), docker 1.11.X (). Also document it as Kubernetes 1.3 release known issue at is also updated admin guide for NodeProblemDetector, and the suggestion on how to handle this issue will be included there. For 1.4, I think we should change kube-proxy. Instead of logging the error then crashing, kube-proxy should report its problem to NodeProblemDector, which aggregates the node issues and propagate them to upstream layers, so that the admin / remedy system & control-plane can take proper action upon the issues. I am removing this from 1.3 milestone, and unassigning myself. cc/ to find the right owner from cluster team for next release here.
On a 2k node cluster, I just saw 4 nodes come up this way on Docker 1.11.2. I'm not saying it's going to stop the release, but it does stop bringup on large clusters pretty frequently. For some reason we went through a "nice" patch where it was rare, but today it was just bad.
We can have a quick fix in node problem detector to catch this kind of problem by parsing the kube-proxy log. The only problem is that, kube-proxy generates logs relatively fast. If we let node problem detector do that, it has to waste significant cpu even on the good nodes. A better solution is to make node problem detector expose an endpoint and let other system components report problems. However, we are not there yet for 1.3. If we'd still want to solve this for 1.3, we could: 1) Let kube-proxy have some kind of error log, and only print error into it. Then we can easily change node problem detector to parse the error log and report problems. By this, we can at least make these errors visible to users for 1.3. 2) Or let kube-proxy report the node condition itself. /cc
Comment at is still valid. We cannot do much for 1.3 release here, and extending NodeProblemDetector to parse the application logs is wrong move. Also NodeProblemDetector is not running on GKE nodes yet.
I'm seeing people say they reproduced on 1.11.2, is there a 1.11 docker issue? I know that was closed. If I'm going to get my docker guys to dig, I need a docker bug report...
Can you please ramp up on this and come up with a way to bring node and kube proxy teams together to resolve? Even if we don't land in 1.3.0, I propose this is at least a P1 for 1.3.1.
FYI and others In I a hacky way of resolving those issues to our test framework. In the last run of gke-large-cluster run it seemed to work (there was 1 broken kube-proxy, this triggered restarting docker, which in turn fixed the problem). This is obviously not the solution, but: it seems to prove that 'docker restart' solves the problem it should stop the bleeding in our tests
& I copied & paste what I wrote in another internal thread to give you some background: No, it is not a blocker for 1.3 release: It is not a regression from 1.2 release. It is way less frequently after we upgrade to docker 1.11.2 from docker 1.9.1 NodeProblemDetector is not designed for processing arbitrary logs. It is an overkill solution given such low frequency and relative high resource overhead. By default NodeProblemDetector is not running on gke node due to the extra overhead per node introduced to our customer. Meanwhile Since GKE already has repair system built, it should be very easy to extend GKE repair system to check if kube-proxy is in crashloop. If yes, then kubectl logs to retrieve the last terminated container log to see if the issue is caused by readonly root filesystem. If yes, the repair system can issue a docker restart.
agreed not a blocker. This is likely only fixable in docker. We should keep it up the priority so we dig into and fix docker. can try next week to get our docker people talking to whoever on your side you want to get this fixed (in 1.11.3 or later probably)
Can we add a node readiness or liveness probe to solve this? (I remember there is a issue for this, but can't find it now) One of the default behaviours of the probe is to make sure the key node components are running normally, and the behaviour could be extended overtime. Probably adding a node probe controller or node health controller to perform the probing. Or just use the health probe of GCE MIG, if its functionality is enough to handle this. This could be part of the remedy system. Just random thoughts, not for 1.3 and even may not work. :)
All are good ideas. But let's move that discussion to a separate issue, and use this one to focus providing the workaround for KubeProxy panic within 1.3 timeframe. Thanks!
Also what you suggested probe controller can be easily achieved by GKE repair system which I suggested above.
Agree. needs quite a lot of work, definitely not for 1.3 :)
Keeping in v1.3 until we decide on Docker 1.11 for sure.
The issue seems to be present on old and new docker alike, sadly.
I opened a docker issue here Feel free to supply information on that issue.
So what's the right kube-proxy fix? , Lantao Liu wrote:
- didn't we decided that we just want to discover this problem in NodeProblemDetector and then mark this node as not-healthy (whatever that means - adding a new condition or extending NodeReady or ...)? In my opinion if it would be clear to user why this node is not healthy, this should be good enough. FYI in I worked around this in our tests :)
It wasn't clear to me if kube-proxy should do something different or not. , Wojciech Tyczynski < :
yeah this is a docker bug (), unsure if there's a pod level workaround, couldn't make out if it was specific to hostNetwork. the work around is restarting docker. It happened more frequently in 1.9, but still happens on 1.11 (node team empirical data). To surface it to the NPD we need to either send some http event to a NPD server (vaporware) or write to a special hostPath termination log type file (parsing kube-proxy logs form NPD is too expensive).
This feels like a hot potato but I am not sure if it still needs to be addressed or not. If it does, let's do so. I apologize for not being able to understand what the current status is. It looks like we have a . Reading comment from 12 days ago she states: While folks may want the node problem detector extended to parse logs to detect it, that is not a good fit for that system and it doesn't run on all nodes anyway. Also GKE can be extended to possibly repair this problem. Questions: Is this an issue that we need to still address for production? Or can we wait for docker fix? If we haven't fixed the kube-proxy panic (which we should) how do ensure we still provide a signal that this is happening?
I am leaving this on 1.3 until we know the best thing to do.
If we can DIRECTLY tell the node problem system about a problem, I have no qualms about doing that. drop a file in a dir, for example. , Michael Rubin wrote:
Node problem detector is not running on GKE cluster now. :) and should be a better fix for this. If we still want a fix in the node problem detector, letting kubeproxy drop a file could be enough for now.
If you can give me a spec of what dir to mount and what sort of file to write, I'll do it. , Lantao Liu wrote:
For temporary fix, something like should be enough. The kernel monitor of node problem detector could be ported to parse other logs. The only reason we can't do that for kube- is that the log is too spammy. should be enough for now. Only the kubeproxy panic error is printed directly into : Even though the default  of glog is , I checked the node in and cluster, normally only few lines are at Error level.
I thought that Dawn said we DO NOT want to parse logs. Parsing logs is, in general, a total hack and very very brittle. we should have a real push API. , Lantao Liu wrote:
I agree with I also understood thought we should not parse logs. Is that common practise for the node problem detector? It feels fragile to me and to be avoided.
Yeah, I agree parsing log is fragile, that's why I call it a temporary or a quick fix. :) The only good thing is that it doesn't need significant change on both sides, although I don't think it's a good solution, either. :( For a better fix, it will need some more design and work. Let me think about it a little more~ Anyway, I still think and is needed. As a key component running on each node, it's wired that we don't have a component to monitor whether it is ready or not.
Re making kube-proxy "not panic", it currently fails in resizing the hash table for conntrack entries, for which it needs to write to /sys. I'm not sure if there are more locations (we moved /sys/module/br_netfilter loading into kubelet IIUC), or if conntrack itself needs write access to /sys. I think Dawn/Liu are more worried about the NPD not parsing kube-proxy logs, because its memory usage would balloon. If kube-proxy can detect the situtation internally, either by parsing its own logs (which is brittle) or poking someting in /sys for example (like the hash table resizing it's currently failing on), it can drop a token into a hostPath (hoping the docker bug doesn't manifest as ro hostPath). Kube-proxy will still remain dysfunctional, though we might be able to: the issue/mark node unusable a feedback loop that restarts docker We just need to be careful to cleanup the hostPath so it doesn't end up in a restart loop.
My understanding of 1.3's state based on a brief chat with : something like ~1 in 1000 nodes will be affected by this issue and if nodes are affected, pods scheduled on those nodes have {broken,little,no} networking. We hope Docker will eventually fix it. But because that's not the case for 1.3, and we don't want to make excessive changes to 1.3, perhaps that means that we should fix it expediently. Summarizing my understanding of previous discussion: expedient thing would be some mechanism to detect ( proposal like kube-proxy detecting and writing to /tmp/kube-proxy-claims-docker-issue-) and $something (kubelet, node problem detector, a bash script in a loop) that checks for existence of that file followed by some form of remediation {kill docker, sudo reboot, .....} to bash the node into working again. Maybe an ugly hack is okay for now and we hope that docker fixes it for the next release so in 1.4 we can rm the code? Or for 1.4 we can do something that is More Elegant And Less Offensive To Engineering Sensibilities?
Bounded-lifetime hacks are fine, but they need to come with giant disclaimers and named-assignees to cleanup the mess after a specific event. , Alex Mohr wrote:
Agree, re: bounded-lifetime hacks needing care and we shouldn't do them indiscriminately. We and our users have a problem today -- and we've had a problem for the past N months without traction. I'd like the problem solved for 1.3 because I'd like us to have a great product and I don't think the state of broken nodes is there. Aside; we've spent N hours discussing the issue and could likely have worked around the issue in less aggregate people time than we spent discussing? Apologies for the leaked frustration: this issue seems to be stuck in either some form of analysis paralysis or cracks between teams or perfect-is-the-enemy-of-the-good state. Again, I don't care about implementation details. We also need more than just tech or a piece of code. Exit criteria is that users don't get broken nodes shipped to them.
We're not going to solve this problem for as long as we depend on a lagging docker release cycle, and they don't backport or do intermediate releases to help us. This is just a one off docker bug that's left us in a bad state. Such issues come up every release, get documented in the release notes and we ship anyway. The easiest fix (disclaimers and all) is to redirect kube-proxy stderr and parse it out from NPD. Even then, the node will remain broken unless we restart docker. the NDP will only surface the error.
I'm working on a PR yesterday night, will send it out soon.
FYI, a fix is here . In , I let kube-proxy update a node condition with specific reason, message and hit to the administrator about the remediation. The specific reason why we want to do this is discussed in the PR description
FWIW I agree 100% with using node condition SGTM, but your PR should probably also modify the scheduler here to prevent the system from sending new pods to a node that has RuntimeUnhealthy condition. I realize there will still be a time window when we might send some pods to that node (before the problem is detected) but at least the time window will be bounded this way.
Yeah, we can do that. But before that, we should make sure that the node is really unusable without setting conntrack. In fact, we only setting conntrack to increase the max connection limit on the node (default 64k-256k) Without this, is the node really considered to be unusable? If so, we should prevent scheduling pods to the node. If not, maybe we should just surface the problem to the administrator and let the node keep working. I'll run e2e test without conntrack set to see whether there is any problem. Yeah, that's why I think we should not restart docker ourselves to try to remedy the problem. There may still be workloads running the node. We'd better leave this to the user to decide. :)
is merged, and hopefully, it could solve this issue. I've also sent a PR to revert the walkaround in the test framework to verify whether the issue is really fully solved. Feel free to reopen this if the issue or relative issue happens again.
thanks for the help!
I just ran into this, and I am able to repro consistently. It might be due to the craziness of my experiment, but I still wanted to contribute the data point. I am experimenting with docker inside docker. All I am about to describe is itself running inside a privileged CentOS 7 container that has systemd and Docker installed. The CentOS 7 container is running on my dev machine (Docker for Mac). I have a kubelet running fine, and all control plane components running as static pods. When I attempt to run kube-proxy as a static pod (privileged) it crashes with the following logs: sysfs is mounted as rw: sysfs is mounted as rw on containers: Using busybox to further inspect:
I'm seeing the same issue when running kubeadm-dind-cluster, where kube-proxy is failing to come up, because it is trying to write to /sys/module/nf_conntrack/parameters/hashsize. This is on the filesystem sysfs, which "mount" shows is rw (so it passes the R/W check in kube-proxy code), but the filesystem is not writeable. Within kube-proxy: I'm also running docker containers inside of docker containers. FYI, others have not seen this issue, when just running docker on bare-metal.

Related discussion:
text: // Tune conntrack, if requested if s.Conntracker != nil { if s.Config.ConntrackMax > 0 { <del> if err := s.Conntracker.SetMax(int(s.Config.ConntrackMax)); err != nil { return err </del> <ins> err := s.Conntracker.SetMax(int(s.Config.ConntrackMax)) if err != nil { if err != readOnlySysFSError { return err } // readOnlySysFSError is caused by a known docker issue (https://github.com/docker/docker/issues/24000), // the only remediation we know is to restart the docker daemon. // Here we'll send an node event with specific reason and message, the // administrator should decide whether and how to handle this issue, // whether to drain the node and restart docker. // TODO(random-liu): Remove this when the docker bug is fixed. const message = "DOCKER RESTART NEEDED (docker issue #24000): /sys is read-only: can't raise conntrack limits, problems may arise later." s.Recorder.Eventf(s.Config.NodeRef, api.EventTypeWarning, err.Error(), message) </ins> } } if s.Config.ConntrackTCPEstablishedTimeout.Duration > 0 {