This repository has been archived by the owner on Aug 25, 2021. It is now read-only.
Consul servers should leave gracefully when they are restarted #760
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Background
Currently, if consul servers are restarted when ACLs are enabled (either by doing the recommended upgrade procedure, doing a stateful set restart, or simply deleting consul server pods), they exit with code 1, which means a non-graceful termination. This is because the pre-stop hook that runs the
consul leave
command doesn't have the right ACL permissions to perform a graceful leave. This could leave the cluster unhealthy and could lead to various errors, including split brain, node name collisions and others.Changes proposed in this PR:
leave_on_terminate
on consul servers totrue
consul leave
since we don't need it anymoreHow I've tested this PR:
kubectl logs -f consul-server-0
kubectl rollout restart sts/consul-server
How I expect reviewers to test this PR:
[Optional] In the same way, as I've described above.
Checklist: