Question:
I'm not sure where the defaults come from but they sometimes drop all packets causing container IPs to become unreachable. ARP fails. I'm not sure if this is related but I also noticed on this machine that the default pfifo qdisc drops all packets. pfifo is the default qdisc for an htb node so it's used in the unconfigured htb qdisc: This is because the default value for queue size is zero. On other machines I've seen the default value set to 1 packet and 1000 packets. When I set the limit explicitly the container becomes reachable again. The broken configuration is applied by kubelet to implement traffic shapping and there is no option to turn this off. This patch fixes the kubelet on broken machines by disabling traffic shapping: cc
does this happen with --configure-cbr0 and packet shaping too? The kubenet implementation just uses the existing kubernetes shaping code that --configure-cbr0 does.
It seems the *fifo qdiscs default their packet limit to the txquelen of the interface (man tc-pfifo). It also seems most virtual interface types (bridge, etc) set a dev-txqueuelen of 0. It further seems that relies on the default packet limit. I could swear this worked before with kubenet, and it must have worked with --configure-cbr0 when the code was originally . I'll check around to figure out what the default limit should be for interfaces that don't specify a tx queue length.
Note that to test with --configure-cbr0 you'd also need --reconcile-cidr.
Upstream CNI fix is here: and we'll also work around it in kubenet for now.
FWIW, the upstream CNI fix got merged for CNI 0.3.0

} } <ins> // ensureBridgeTxQueueLen() ensures that the bridge interface's TX queue // length is greater than zero.  Due to a CNI <= 0.3.0 'bridge' plugin bug, // the bridge is initially created with a TX queue length of 0, which gets // used as the packet limit for FIFO traffic shapers, which drops packets. // TODO: remove when we can depend on a fixed CNI func (plugin *kubenetNetworkPlugin) ensureBridgeTxQueueLen() { bridge, err := netlink.LinkByName(BridgeName) if err != nil { return } if bridge.Attrs().TxQLen > 0 { return } req := nl.NewNetlinkRequest(syscall.RTM_NEWLINK, syscall.NLM_F_ACK) msg := nl.NewIfInfomsg(syscall.AF_UNSPEC) req.AddData(msg) nameData := nl.NewRtAttr(syscall.IFLA_IFNAME, nl.ZeroTerminated(BridgeName)) req.AddData(nameData) qlen := nl.NewRtAttr(syscall.IFLA_TXQLEN, nl.Uint32Attr(1000)) req.AddData(qlen) _, err = req.Execute(syscall.NETLINK_ROUTE, 0) if err != nil { glog.V(5).Infof("Failed to set bridge tx queue length: %v", err) } } </ins> func (plugin *kubenetNetworkPlugin) Name() string { return KubenetPluginName }


Question:
I'm not sure where the defaults come from but they sometimes drop all packets causing container IPs to become unreachable. ARP fails. I'm not sure if this is related but I also noticed on this machine that the default pfifo qdisc drops all packets. pfifo is the default qdisc for an htb node so it's used in the unconfigured htb qdisc: This is because the default value for queue size is zero. On other machines I've seen the default value set to 1 packet and 1000 packets. When I set the limit explicitly the container becomes reachable again. The broken configuration is applied by kubelet to implement traffic shapping and there is no option to turn this off. This patch fixes the kubelet on broken machines by disabling traffic shapping: cc
does this happen with --configure-cbr0 and packet shaping too? The kubenet implementation just uses the existing kubernetes shaping code that --configure-cbr0 does.
It seems the *fifo qdiscs default their packet limit to the txquelen of the interface (man tc-pfifo). It also seems most virtual interface types (bridge, etc) set a dev-txqueuelen of 0. It further seems that relies on the default packet limit. I could swear this worked before with kubenet, and it must have worked with --configure-cbr0 when the code was originally . I'll check around to figure out what the default limit should be for interfaces that don't specify a tx queue length.
Note that to test with --configure-cbr0 you'd also need --reconcile-cidr.
Upstream CNI fix is here: and we'll also work around it in kubenet for now.
FWIW, the upstream CNI fix got merged for CNI 0.3.0

if plugin.shaper == nil { return fmt.Errorf("Failed to create bandwidth shaper!") } <ins> plugin.ensureBridgeTxQueueLen() </ins> plugin.shaper.ReconcileInterface() }


Question:
At least twice now, we've created a namespace and seen that the corresponding service account default secret token is never created. (The service account itself is, but not the default secret.) Namespace creation + apiserver logs logstash-ingester: namespace creation triggered service account creation but no secret logstash-broker: namespace creation triggered service account creation and secret creation Resulting service accounts Resulting secrets Controller-manager logs for broken case Controller-manager logs for working case Version Info:
Dupe of , fixed in
Actually, not a dupe. This may be a consequence of other refactors to controller logic - possibly we are missing / dropping events out of the queue. I would expect it to get fixed on the sync interval though.
We are also seeing this happening from time to time. In our case, it wasn't fixed in the next sync interval but it took actually a little bit more of 24 hours.
can we resolve this and remove it from the 1.6 milestone?
fixed in in 1.4
We just hit this exact issue running 1.5.2. Maybe the fix didn't get the root cause or there was a regression since 1.4? This should be reopened. I waited about an hour to see if the sync interval would resolve this but it did not. I fixed by deleting and recreating the namespace. I can share logs, but they are identical to what the OP noted. Version info:
Working with this seems like it's not fixed in v1.5.2 -- what should we do here? We don't have permission to re-open the ticket, but filing the same ticket with the same logs (just fresher dates) seems passive-aggressive. :-) What's your preference?
no problem, just getting back to this. can reopen this issue.
can you recreate with the controller manager running at and include controller manager log lines from ?
Fresh repo, offending namespace "foo96", with "--v=5" since we already have that logging level in place on my dev stack. This took 96 repros of a "create namespace / monitor for token creation / delete namespace" loop. Our script's commands, starting just after 16:36:43: Controller manager log lines from The first reference to the offending namespace (foo96) and the one other entry afterwards: All controller manager log lines citing the offending namespace: For comparison, the previous successfully-created namespace: Status as of 20 minutes later:
Also, here's the apiserver logs + controller manager logs, for more action/reaction context: Namespace: foo96 (problem) Namespace: foo95 (success)
that's helpful, thanks. it looks like while the token controller is processing the creation event for the service account, it does a live lookup against etcd and fails to find the service account. what version of etcd are you running with? are you running HA etcd? do you have quorum read enabled?
We run etcd version 2.3.7 (previously saw this on 2.2.x as well). We run etcd HA, with a 3 node cluster. We do not run the apiserver with the --etcd-quorum-read flag enabled.
(Note: My specific logs above from this morning are on etcd 2.2.5, but yeah we've seen repro on 2.3.7 as well.)
yeah, the non-quorum HA etcd config is the issue. I can look into updating the token controller to tolerate that, but I'm positive there are similar issues in many controllers that assume live lookups are reliable
Ahh excellent, glad to have an explanation! So -- now that we know what to google for, we found -- where you and clayton addressed what appears to be this same problem for service accounts, and specifically noted that you wanted to avoid recommending quorum reads. Why is the answer different here? Is it because the downstream impact of non-quorum reads is too diverse to reliably retry every relevant action? (Totally fine if that's the answer, just trying to make sure we understand the reason for what appears to be an entirely opposite conclusion to the same type of problem.)
I still think controllers should be built to tolerate weak reads, and I'm willing to fix the token controller bug here, but three factors make me think this position is a losing battle: quorum read got a lot cheaper with etcd3 there are strong opinions that etcd quorum read should be on () which means that very few people are writing controllers designed to tolerate weak reads all the CI tests I'm aware of run with a single etcd or with quorum reads on
Perfect, works for us. As for fixing this particular token controller bug, I no longer have skin in that game -- your call entirely. :-)

// service account no longer exists, so delete related tokens glog.V(4).Infof("syncServiceAccount(%s/%s), service account deleted, removing tokens", saInfo.namespace, saInfo.name) sa = &v1.ServiceAccount{ObjectMeta: metav1.ObjectMeta{Namespace: saInfo.namespace, Name: saInfo.name, UID: saInfo.uid}} <del> if retriable, err := e.deleteTokens(sa); err != nil { </del> <ins> retry, err = e.deleteTokens(sa) if err != nil { </ins> glog.Errorf("error deleting serviceaccount tokens for %s/%s: %v", saInfo.namespace, saInfo.name, err) <del> retry = retriable </del> } default: // ensure a token exists and is referenced by this service account <del> if retriable, err := e.ensureReferencedToken(sa); err != nil { </del> <ins> retry, err = e.ensureReferencedToken(sa) if err != nil { </ins> glog.Errorf("error synchronizing serviceaccount %s/%s: %v", saInfo.namespace, saInfo.name, err) <del> retry = retriable </del> } } }


Question:
At least twice now, we've created a namespace and seen that the corresponding service account default secret token is never created. (The service account itself is, but not the default secret.) Namespace creation + apiserver logs logstash-ingester: namespace creation triggered service account creation but no secret logstash-broker: namespace creation triggered service account creation and secret creation Resulting service accounts Resulting secrets Controller-manager logs for broken case Controller-manager logs for working case Version Info:
Dupe of , fixed in
Actually, not a dupe. This may be a consequence of other refactors to controller logic - possibly we are missing / dropping events out of the queue. I would expect it to get fixed on the sync interval though.
We are also seeing this happening from time to time. In our case, it wasn't fixed in the next sync interval but it took actually a little bit more of 24 hours.
can we resolve this and remove it from the 1.6 milestone?
fixed in in 1.4
We just hit this exact issue running 1.5.2. Maybe the fix didn't get the root cause or there was a regression since 1.4? This should be reopened. I waited about an hour to see if the sync interval would resolve this but it did not. I fixed by deleting and recreating the namespace. I can share logs, but they are identical to what the OP noted. Version info:
Working with this seems like it's not fixed in v1.5.2 -- what should we do here? We don't have permission to re-open the ticket, but filing the same ticket with the same logs (just fresher dates) seems passive-aggressive. :-) What's your preference?
no problem, just getting back to this. can reopen this issue.
can you recreate with the controller manager running at and include controller manager log lines from ?
Fresh repo, offending namespace "foo96", with "--v=5" since we already have that logging level in place on my dev stack. This took 96 repros of a "create namespace / monitor for token creation / delete namespace" loop. Our script's commands, starting just after 16:36:43: Controller manager log lines from The first reference to the offending namespace (foo96) and the one other entry afterwards: All controller manager log lines citing the offending namespace: For comparison, the previous successfully-created namespace: Status as of 20 minutes later:
Also, here's the apiserver logs + controller manager logs, for more action/reaction context: Namespace: foo96 (problem) Namespace: foo95 (success)
that's helpful, thanks. it looks like while the token controller is processing the creation event for the service account, it does a live lookup against etcd and fails to find the service account. what version of etcd are you running with? are you running HA etcd? do you have quorum read enabled?
We run etcd version 2.3.7 (previously saw this on 2.2.x as well). We run etcd HA, with a 3 node cluster. We do not run the apiserver with the --etcd-quorum-read flag enabled.
(Note: My specific logs above from this morning are on etcd 2.2.5, but yeah we've seen repro on 2.3.7 as well.)
yeah, the non-quorum HA etcd config is the issue. I can look into updating the token controller to tolerate that, but I'm positive there are similar issues in many controllers that assume live lookups are reliable
Ahh excellent, glad to have an explanation! So -- now that we know what to google for, we found -- where you and clayton addressed what appears to be this same problem for service accounts, and specifically noted that you wanted to avoid recommending quorum reads. Why is the answer different here? Is it because the downstream impact of non-quorum reads is too diverse to reliably retry every relevant action? (Totally fine if that's the answer, just trying to make sure we understand the reason for what appears to be an entirely opposite conclusion to the same type of problem.)
I still think controllers should be built to tolerate weak reads, and I'm willing to fix the token controller bug here, but three factors make me think this position is a losing battle: quorum read got a lot cheaper with etcd3 there are strong opinions that etcd quorum read should be on () which means that very few people are writing controllers designed to tolerate weak reads all the CI tests I'm aware of run with a single etcd or with quorum reads on
Perfect, works for us. As for fixing this particular token controller bug, I no longer have skin in that game -- your call entirely. :-)

// ensureReferencedToken makes sure at least one ServiceAccountToken secret exists, and is included in the serviceAccount's Secrets list func (e *TokensController) ensureReferencedToken(serviceAccount *v1.ServiceAccount) ( /* retry */ bool, error) { <del> if len(serviceAccount.Secrets) > 0 { allSecrets, err := e.listTokenSecrets(serviceAccount) if err != nil { // Don't retry cache lookup errors return false, err } referencedSecrets := getSecretReferences(serviceAccount) for _, secret := range allSecrets { if referencedSecrets.Has(secret.Name) { // A service account token already exists, and is referenced, short-circuit return false, nil } } </del> <ins> if hasToken, err := e.hasReferencedToken(serviceAccount); err != nil { // Don't retry cache lookup errors return false, err } else if hasToken { // A service account token already exists, and is referenced, short-circuit return false, nil </ins> } // We don't want to update the cache's copy of the service account


Question:
At least twice now, we've created a namespace and seen that the corresponding service account default secret token is never created. (The service account itself is, but not the default secret.) Namespace creation + apiserver logs logstash-ingester: namespace creation triggered service account creation but no secret logstash-broker: namespace creation triggered service account creation and secret creation Resulting service accounts Resulting secrets Controller-manager logs for broken case Controller-manager logs for working case Version Info:
Dupe of , fixed in
Actually, not a dupe. This may be a consequence of other refactors to controller logic - possibly we are missing / dropping events out of the queue. I would expect it to get fixed on the sync interval though.
We are also seeing this happening from time to time. In our case, it wasn't fixed in the next sync interval but it took actually a little bit more of 24 hours.
can we resolve this and remove it from the 1.6 milestone?
fixed in in 1.4
We just hit this exact issue running 1.5.2. Maybe the fix didn't get the root cause or there was a regression since 1.4? This should be reopened. I waited about an hour to see if the sync interval would resolve this but it did not. I fixed by deleting and recreating the namespace. I can share logs, but they are identical to what the OP noted. Version info:
Working with this seems like it's not fixed in v1.5.2 -- what should we do here? We don't have permission to re-open the ticket, but filing the same ticket with the same logs (just fresher dates) seems passive-aggressive. :-) What's your preference?
no problem, just getting back to this. can reopen this issue.
can you recreate with the controller manager running at and include controller manager log lines from ?
Fresh repo, offending namespace "foo96", with "--v=5" since we already have that logging level in place on my dev stack. This took 96 repros of a "create namespace / monitor for token creation / delete namespace" loop. Our script's commands, starting just after 16:36:43: Controller manager log lines from The first reference to the offending namespace (foo96) and the one other entry afterwards: All controller manager log lines citing the offending namespace: For comparison, the previous successfully-created namespace: Status as of 20 minutes later:
Also, here's the apiserver logs + controller manager logs, for more action/reaction context: Namespace: foo96 (problem) Namespace: foo95 (success)
that's helpful, thanks. it looks like while the token controller is processing the creation event for the service account, it does a live lookup against etcd and fails to find the service account. what version of etcd are you running with? are you running HA etcd? do you have quorum read enabled?
We run etcd version 2.3.7 (previously saw this on 2.2.x as well). We run etcd HA, with a 3 node cluster. We do not run the apiserver with the --etcd-quorum-read flag enabled.
(Note: My specific logs above from this morning are on etcd 2.2.5, but yeah we've seen repro on 2.3.7 as well.)
yeah, the non-quorum HA etcd config is the issue. I can look into updating the token controller to tolerate that, but I'm positive there are similar issues in many controllers that assume live lookups are reliable
Ahh excellent, glad to have an explanation! So -- now that we know what to google for, we found -- where you and clayton addressed what appears to be this same problem for service accounts, and specifically noted that you wanted to avoid recommending quorum reads. Why is the answer different here? Is it because the downstream impact of non-quorum reads is too diverse to reliably retry every relevant action? (Totally fine if that's the answer, just trying to make sure we understand the reason for what appears to be an entirely opposite conclusion to the same type of problem.)
I still think controllers should be built to tolerate weak reads, and I'm willing to fix the token controller bug here, but three factors make me think this position is a losing battle: quorum read got a lot cheaper with etcd3 there are strong opinions that etcd quorum read should be on () which means that very few people are writing controllers designed to tolerate weak reads all the CI tests I'm aware of run with a single etcd or with quorum reads on
Perfect, works for us. As for fixing this particular token controller bug, I no longer have skin in that game -- your call entirely. :-)

serviceAccounts := e.client.Core().ServiceAccounts(serviceAccount.Namespace) liveServiceAccount, err := serviceAccounts.Get(serviceAccount.Name, metav1.GetOptions{}) if err != nil { <del> // Retry for any error other than a NotFound return !apierrors.IsNotFound(err), err </del> <ins> // Retry if we cannot fetch the live service account (for a NotFound error, either the live lookup or our cache are stale) return true, err </ins> } if liveServiceAccount.ResourceVersion != serviceAccount.ResourceVersion { <del> // our view of the service account is not up to date // we'll get notified of an update event later and get to try again glog.V(2).Infof("serviceaccount %s/%s is not up to date, skipping token creation", serviceAccount.Namespace, serviceAccount.Name) return false, nil </del> <ins> // Retry if our liveServiceAccount doesn't match our cache's resourceVersion (either the live lookup or our cache are stale) glog.V(4).Infof("liveServiceAccount.ResourceVersion (%s) does not match cache (%s), retrying", liveServiceAccount.ResourceVersion, serviceAccount.ResourceVersion) return true, nil </ins> } // Build the secret


Question:
At least twice now, we've created a namespace and seen that the corresponding service account default secret token is never created. (The service account itself is, but not the default secret.) Namespace creation + apiserver logs logstash-ingester: namespace creation triggered service account creation but no secret logstash-broker: namespace creation triggered service account creation and secret creation Resulting service accounts Resulting secrets Controller-manager logs for broken case Controller-manager logs for working case Version Info:
Dupe of , fixed in
Actually, not a dupe. This may be a consequence of other refactors to controller logic - possibly we are missing / dropping events out of the queue. I would expect it to get fixed on the sync interval though.
We are also seeing this happening from time to time. In our case, it wasn't fixed in the next sync interval but it took actually a little bit more of 24 hours.
can we resolve this and remove it from the 1.6 milestone?
fixed in in 1.4
We just hit this exact issue running 1.5.2. Maybe the fix didn't get the root cause or there was a regression since 1.4? This should be reopened. I waited about an hour to see if the sync interval would resolve this but it did not. I fixed by deleting and recreating the namespace. I can share logs, but they are identical to what the OP noted. Version info:
Working with this seems like it's not fixed in v1.5.2 -- what should we do here? We don't have permission to re-open the ticket, but filing the same ticket with the same logs (just fresher dates) seems passive-aggressive. :-) What's your preference?
no problem, just getting back to this. can reopen this issue.
can you recreate with the controller manager running at and include controller manager log lines from ?
Fresh repo, offending namespace "foo96", with "--v=5" since we already have that logging level in place on my dev stack. This took 96 repros of a "create namespace / monitor for token creation / delete namespace" loop. Our script's commands, starting just after 16:36:43: Controller manager log lines from The first reference to the offending namespace (foo96) and the one other entry afterwards: All controller manager log lines citing the offending namespace: For comparison, the previous successfully-created namespace: Status as of 20 minutes later:
Also, here's the apiserver logs + controller manager logs, for more action/reaction context: Namespace: foo96 (problem) Namespace: foo95 (success)
that's helpful, thanks. it looks like while the token controller is processing the creation event for the service account, it does a live lookup against etcd and fails to find the service account. what version of etcd are you running with? are you running HA etcd? do you have quorum read enabled?
We run etcd version 2.3.7 (previously saw this on 2.2.x as well). We run etcd HA, with a 3 node cluster. We do not run the apiserver with the --etcd-quorum-read flag enabled.
(Note: My specific logs above from this morning are on etcd 2.2.5, but yeah we've seen repro on 2.3.7 as well.)
yeah, the non-quorum HA etcd config is the issue. I can look into updating the token controller to tolerate that, but I'm positive there are similar issues in many controllers that assume live lookups are reliable
Ahh excellent, glad to have an explanation! So -- now that we know what to google for, we found -- where you and clayton addressed what appears to be this same problem for service accounts, and specifically noted that you wanted to avoid recommending quorum reads. Why is the answer different here? Is it because the downstream impact of non-quorum reads is too diverse to reliably retry every relevant action? (Totally fine if that's the answer, just trying to make sure we understand the reason for what appears to be an entirely opposite conclusion to the same type of problem.)
I still think controllers should be built to tolerate weak reads, and I'm willing to fix the token controller bug here, but three factors make me think this position is a losing battle: quorum read got a lot cheaper with etcd3 there are strong opinions that etcd quorum read should be on () which means that very few people are writing controllers designed to tolerate weak reads all the CI tests I'm aware of run with a single etcd or with quorum reads on
Perfect, works for us. As for fixing this particular token controller bug, I no longer have skin in that game -- your call entirely. :-)

// This prevents the service account update (below) triggering another token creation, if the referenced token couldn't be found in the store e.secrets.Add(createdToken) <del> liveServiceAccount.Secrets = append(liveServiceAccount.Secrets, v1.ObjectReference{Name: secret.Name}) </del> <ins> // Try to add a reference to the newly created token to the service account addedReference := false err = clientretry.RetryOnConflict(clientretry.DefaultRetry, func() error { // refresh liveServiceAccount on every retry defer func() { liveServiceAccount = nil }() // fetch the live service account if needed, and verify the UID matches and that we still need a token if liveServiceAccount == nil { liveServiceAccount, err = serviceAccounts.Get(serviceAccount.Name, metav1.GetOptions{}) if err != nil { return err } if liveServiceAccount.UID != serviceAccount.UID { // If we don't have the same service account, stop trying to add a reference to the token made for the old service account. return nil } if hasToken, err := e.hasReferencedToken(liveServiceAccount); err != nil { // Don't retry cache lookup errors return nil } else if hasToken { // A service account token already exists, and is referenced, short-circuit return nil } } // Try to add a reference to the token liveServiceAccount.Secrets = append(liveServiceAccount.Secrets, v1.ObjectReference{Name: secret.Name}) if _, err := serviceAccounts.Update(liveServiceAccount); err != nil { return err } </ins> <del> if _, err = serviceAccounts.Update(liveServiceAccount); err != nil { </del> <ins> addedReference = true return nil }) if !addedReference { </ins> // we weren't able to use the token, try to clean it up. glog.V(2).Infof("deleting secret %s/%s because reference couldn't be added (%v)", secret.Namespace, secret.Name, err) deleteOpts := &metav1.DeleteOptions{Preconditions: &metav1.Preconditions{UID: &createdToken.UID}} if deleteErr := e.client.Core().Secrets(createdToken.Namespace).Delete(createdToken.Name, deleteOpts); deleteErr != nil { glog.Error(deleteErr) // if we fail, just log it } <ins> } if err != nil { </ins> if apierrors.IsConflict(err) || apierrors.IsNotFound(err) { // if we got a Conflict error, the service account was updated by someone else, and we'll get an update notification later // if we got a NotFound error, the service account no longer exists, and we don't need to create a token for it


Question:
At least twice now, we've created a namespace and seen that the corresponding service account default secret token is never created. (The service account itself is, but not the default secret.) Namespace creation + apiserver logs logstash-ingester: namespace creation triggered service account creation but no secret logstash-broker: namespace creation triggered service account creation and secret creation Resulting service accounts Resulting secrets Controller-manager logs for broken case Controller-manager logs for working case Version Info:
Dupe of , fixed in
Actually, not a dupe. This may be a consequence of other refactors to controller logic - possibly we are missing / dropping events out of the queue. I would expect it to get fixed on the sync interval though.
We are also seeing this happening from time to time. In our case, it wasn't fixed in the next sync interval but it took actually a little bit more of 24 hours.
can we resolve this and remove it from the 1.6 milestone?
fixed in in 1.4
We just hit this exact issue running 1.5.2. Maybe the fix didn't get the root cause or there was a regression since 1.4? This should be reopened. I waited about an hour to see if the sync interval would resolve this but it did not. I fixed by deleting and recreating the namespace. I can share logs, but they are identical to what the OP noted. Version info:
Working with this seems like it's not fixed in v1.5.2 -- what should we do here? We don't have permission to re-open the ticket, but filing the same ticket with the same logs (just fresher dates) seems passive-aggressive. :-) What's your preference?
no problem, just getting back to this. can reopen this issue.
can you recreate with the controller manager running at and include controller manager log lines from ?
Fresh repo, offending namespace "foo96", with "--v=5" since we already have that logging level in place on my dev stack. This took 96 repros of a "create namespace / monitor for token creation / delete namespace" loop. Our script's commands, starting just after 16:36:43: Controller manager log lines from The first reference to the offending namespace (foo96) and the one other entry afterwards: All controller manager log lines citing the offending namespace: For comparison, the previous successfully-created namespace: Status as of 20 minutes later:
Also, here's the apiserver logs + controller manager logs, for more action/reaction context: Namespace: foo96 (problem) Namespace: foo95 (success)
that's helpful, thanks. it looks like while the token controller is processing the creation event for the service account, it does a live lookup against etcd and fails to find the service account. what version of etcd are you running with? are you running HA etcd? do you have quorum read enabled?
We run etcd version 2.3.7 (previously saw this on 2.2.x as well). We run etcd HA, with a 3 node cluster. We do not run the apiserver with the --etcd-quorum-read flag enabled.
(Note: My specific logs above from this morning are on etcd 2.2.5, but yeah we've seen repro on 2.3.7 as well.)
yeah, the non-quorum HA etcd config is the issue. I can look into updating the token controller to tolerate that, but I'm positive there are similar issues in many controllers that assume live lookups are reliable
Ahh excellent, glad to have an explanation! So -- now that we know what to google for, we found -- where you and clayton addressed what appears to be this same problem for service accounts, and specifically noted that you wanted to avoid recommending quorum reads. Why is the answer different here? Is it because the downstream impact of non-quorum reads is too diverse to reliably retry every relevant action? (Totally fine if that's the answer, just trying to make sure we understand the reason for what appears to be an entirely opposite conclusion to the same type of problem.)
I still think controllers should be built to tolerate weak reads, and I'm willing to fix the token controller bug here, but three factors make me think this position is a losing battle: quorum read got a lot cheaper with etcd3 there are strong opinions that etcd quorum read should be on () which means that very few people are writing controllers designed to tolerate weak reads all the CI tests I'm aware of run with a single etcd or with quorum reads on
Perfect, works for us. As for fixing this particular token controller bug, I no longer have skin in that game -- your call entirely. :-)

return false, nil } <ins> // hasReferencedToken returns true if the serviceAccount references a service account token secret func (e *TokensController) hasReferencedToken(serviceAccount *v1.ServiceAccount) (bool, error) { if len(serviceAccount.Secrets) == 0 { return false, nil } allSecrets, err := e.listTokenSecrets(serviceAccount) if err != nil { return false, err } referencedSecrets := getSecretReferences(serviceAccount) for _, secret := range allSecrets { if referencedSecrets.Has(secret.Name) { return true, nil } } return false, nil } </ins> func (e *TokensController) secretUpdateNeeded(secret *v1.Secret) (bool, bool, bool) { caData := secret.Data[v1.ServiceAccountRootCAKey] needsCA := len(e.rootCA) > 0 && bytes.Compare(caData, e.rootCA) != 0


Question:
When users try to label/annotate multiple resources, we should tell them to add . Current output: Expected output:
and too
Instead of "--all is false", say "multiple resources were provided, but no label selector or --all flag specified"
Description updated based on suggestion
I think "resource(s) were provided, but no name, label selector, or --all flag specified" is better. I will send a pull request for this as my first PR.

"k8s.io/kubernetes/pkg/api/errors" "k8s.io/kubernetes/pkg/api/testapi" "k8s.io/kubernetes/pkg/api/unversioned" <ins> "k8s.io/kubernetes/pkg/client/restclient" </ins> "k8s.io/kubernetes/pkg/client/unversioned/fake" )


Question:
When users try to label/annotate multiple resources, we should tell them to add . Current output: Expected output:
and too
Instead of "--all is false", say "multiple resources were provided, but no label selector or --all flag specified"
Description updated based on suggestion
I think "resource(s) were provided, but no name, label selector, or --all flag specified" is better. I will send a pull request for this as my first PR.

t.Errorf("unexpected output: %s", buf.String()) } } <ins> func TestResourceErrors(t *testing.T) { testCases := map[string]struct { args  []string flags map[string]string errFn func(error) bool }{ "no args": { args:  []string{}, errFn: func(err error) bool { return strings.Contains(err.Error(), "you must provide one or more resources") }, }, "resources but no selectors": { args: []string{"pods"}, errFn: func(err error) bool { return strings.Contains(err.Error(), "resource(s) were provided, but no name, label selector, or --all flag specified") }, }, "multiple resources but no selectors": { args: []string{"pods,deployments"}, errFn: func(err error) bool { return strings.Contains(err.Error(), "resource(s) were provided, but no name, label selector, or --all flag specified") }, }, } for k, testCase := range testCases { f, tf, _ := NewAPIFactory() tf.Printer = &testPrinter{} tf.Namespace = "test" tf.ClientConfig = &restclient.Config{ContentConfig: restclient.ContentConfig{GroupVersion: testapi.Default.GroupVersion()}} buf := bytes.NewBuffer([]byte{}) cmd := NewCmdDelete(f, buf) cmd.SetOutput(buf) for k, v := range testCase.flags { cmd.Flags().Set(k, v) } err := RunDelete(f, buf, cmd, testCase.args, &DeleteOptions{}) if !testCase.errFn(err) { t.Errorf("%s: unexpected error: %v", k, err) continue } if tf.Printer.(*testPrinter).Objects != nil { t.Errorf("unexpected print to default printer") } if buf.Len() > 0 { t.Errorf("buffer should be empty: %s", string(buf.Bytes())) } } } </ins>


Question:
When users try to label/annotate multiple resources, we should tell them to add . Current output: Expected output:
and too
Instead of "--all is false", say "multiple resources were provided, but no label selector or --all flag specified"
Description updated based on suggestion
I think "resource(s) were provided, but no name, label selector, or --all flag specified" is better. I will send a pull request for this as my first PR.

args:  []string{"pods=bar"}, errFn: func(err error) bool { return strings.Contains(err.Error(), "one or more resources must be specified") }, }, <ins> "resources but no selectors": { args: []string{"pods", "app=bar"}, errFn: func(err error) bool { return strings.Contains(err.Error(), "resource(s) were provided, but no name, label selector, or --all flag specified") }, }, "multiple resources but no selectors": { args: []string{"pods,deployments", "app=bar"}, errFn: func(err error) bool { return strings.Contains(err.Error(), "resource(s) were provided, but no name, label selector, or --all flag specified") }, }, </ins> } for k, testCase := range testCases {


Question:
When users try to label/annotate multiple resources, we should tell them to add . Current output: Expected output:
and too
Instead of "--all is false", say "multiple resources were provided, but no label selector or --all flag specified"
Description updated based on suggestion
I think "resource(s) were provided, but no name, label selector, or --all flag specified" is better. I will send a pull request for this as my first PR.

return &Result{singular: singular, visitor: visitors, sources: b.paths} } <ins> if len(b.resources) != 0 { return &Result{err: fmt.Errorf("resource(s) were provided, but no name, label selector, or --all flag specified")} } </ins> return &Result{err: fmt.Errorf("you must provide one or more resources by argument or filename (%s)", strings.Join(InputExtensions, "|"))} }


Question:
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.

package app import ( <ins> "errors" </ins> "io/ioutil" "strconv" "github.com/golang/glog" <ins> "k8s.io/kubernetes/pkg/util/mount" </ins> "k8s.io/kubernetes/pkg/util/sysctl" )


Question:
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.

type realConntracker struct{} <ins> var readOnlySysFSError = errors.New("ReadOnlySysFS") </ins> func (realConntracker) SetMax(max int) error { glog.Infof("Setting nf_conntrack_max to %d", max) if err := sysctl.SetSysctl("net/netfilter/nf_conntrack_max", max); err != nil { return err } <ins> // sysfs is expected to be mounted as 'rw'. However, it may be unexpectedly mounted as // 'ro' by docker because of a known docker issue (https://github.com/docker/docker/issues/24000). // Setting conntrack will fail when sysfs is readonly. When that happens, we don't set conntrack // hashsize and return a special error readOnlySysFSError here. The caller should deal with // readOnlySysFSError differently. writable, err := isSysFSWritable() if err != nil { return err } if !writable { return readOnlySysFSError } </ins> // TODO: generify this and sysctl to a new sysfs.WriteInt() glog.Infof("Setting conntrack hashsize to %d", max/4) return ioutil.WriteFile("/sys/module/nf_conntrack/parameters/hashsize", []byte(strconv.Itoa(max/4)), 0640)