-
Notifications
You must be signed in to change notification settings - Fork 670
Fix 2797 on Kubernetes - Cluster goes down because all IPs become unreachable #3149
Conversation
Not just a location change for the API, but also a functional change. Will need to refactor code to use new API methods. |
a0e9ab6
to
2c32a49
Compare
- apiVersion: rbac.authorization.k8s.io/v1beta1 | ||
kind: Role | ||
metadata: | ||
name: weave-net2 |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
@@ -47,6 +47,44 @@ items: | |||
- kind: ServiceAccount | |||
name: weave-net | |||
namespace: kube-system | |||
- apiVersion: rbac.authorization.k8s.io/v1beta1 |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few more things not mentioned in my comments:
- The commit 71bc6f7 message mentions "should break up this commit".
- It would be useful to have some short explanations in a form of commit message for some non-trivial commits explaining why a change is needed.
- How safe do we fell about this change? Have we inspected a code coverage (you can find it among CircleCI artifacts) that all branches of
reclaimRemovedPeers
are tested? - What happens when some nodes in a cluster are powered by older version of weave-kube? Have we tested that upgrade works?
- A few sentences (probably in a form of pkg doc) about how all this thing works would be helpful.
- apiVersion: rbac.authorization.k8s.io/v1beta1 | ||
kind: Role | ||
metadata: | ||
name: weave-net2 |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
greyly echo "Setting up kubernetes cluster" | ||
tear_down_kubeadm; | ||
|
||
# Make an ipset, so we can check it doesn't get wiped out by Weave Net |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
function check_no_lost_ip_addresses { | ||
for host in $HOSTS; do | ||
unreachable_count=$(run_on $host "sudo weave status ipam" | grep "unreachable" | wc -l) | ||
if [ "$unreachable_count" -gt "0" ]; then |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
@@ -0,0 +1,122 @@ | |||
#! /bin/bash |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
|
||
check_no_lost_ip_addresses; | ||
|
||
force_drop_node; |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
prog/kube-peers/annotations.go
Outdated
) | ||
|
||
func (cml *configMapAnnotations) Init() error { | ||
for { // Loop only if we call Create() and it's already there |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
return | ||
} | ||
err = f() | ||
if err != nil && kubeErrors.IsConflict(err) { |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
|
||
// Step 3-5 is to protect against two simultaneous rmpeers of X | ||
// Step 4 is to pick up again after a restart between step 5 and step 7b | ||
// If the peer doing the reclaim disappears between steps 5 and 7a, then someone will clean it up in step 7aa |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
@@ -47,6 +47,44 @@ items: | |||
- kind: ServiceAccount | |||
name: weave-net | |||
namespace: kube-system | |||
- apiVersion: rbac.authorization.k8s.io/v1beta1 |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
prog/kube-peers/annotations.go
Outdated
return cml.UpdateAnnotation(KubePeersAnnotationKey, string(recordBytes)) | ||
} | ||
|
||
func (cml *configMapAnnotations) GetAnnotation(key string) (string, bool) { |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
df1a05f
to
05ac956
Compare
Any thoughts on when this will be merged into a release? This is an extremely critical piece of functionality when running K8S on a dynamic infrastructure, weave becomes pretty much unusable when an error (#2797) occurs. |
@skny5 right now we're trying to clear up all the points and give it another thorough review; hopefully days rather than weeks. |
@skny5 Working on it as we speak. Hoping this will pass review and hit mainline this week. |
Some notes from my testing: I fired up a 3-node Kubernetes cluster using the test 840 script. Next I restarted one of the remaining weave-net pods, so it would notice the node had gone; this all appeared to go to plan:
I attempted to rejoin brya-2 using I manually deleted the persistence file then went through slightly puzzling ipam state, presumably because it reclaimed the bridge address and nothing further:
After moving one of the
Next I am going to abruptly shut down [24 hours later...] Node status goes to |
@bboreham I haven't encountered this. Running I am getting the following from somewhere when listening to the
Although apparently not from the weave-net codebase? (ran a search for "Removed" and "unreachable", and git couldn't find it!) Is it at this point (or after some retries) that we should be removing the IP allocations for that peer? This is the log I get when removing a peer with
But
Pretty sure I'm running your latest version. (I get the |
|
Ok, I'll amend the test to delete the node using |
ipam_status=$(run_on $host "sudo weave status ipam") | ||
echo $ipam_status | ||
unreachable_count=$(echo $ipam_status | grep "unreachable" | wc -l) | ||
if [ "$unreachable_count" != "0" ]; then |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
01c78de
to
e12d9de
Compare
9ee88aa
to
678f574
Compare
678f574
to
1e1d7ab
Compare
I think this is in fairly good shape; I am minded to merge it and raise new issues for follow-up. One area we need to cover off is what happens when you upgrade from a previous release - the current code will delete persisted data which is ok if you do it one node at a time but not idea. Also we need to update the cloud.weave.works config generator. |
This is prework for a feature which will remove 'dead' peers
Loop using jitter until the update succeeds
Also tag kube-peer log messages with "[kube-peers]": in a standard deployment they end up interspersed with weaver log messages so this makes it easier to pick them out.
Add features to weaver and kube-peers to find the peer name and check if it is in the list, then in launch.sh delete persisted data if not.
318aa04
to
90f4f7b
Compare
PR to fix #2797. Includes changes from #3022.