Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow uneven etcd zones #6641

Merged

Conversation

adammw
Copy link
Contributor

@adammw adammw commented Mar 20, 2019

Previously trying to use multiple etcd members on two AZs would result in the "there should be an odd number of master-zones" error, even if there was an odd number of etcd members.

This change fixes the etcdNames check by actually storing the values in the map, and uses that to check that the number of etcd members is an odd number, even if the zones are reused (there is an existing warning for that).

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Mar 20, 2019
@k8s-ci-robot
Copy link
Contributor

Hi @adammw. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Mar 20, 2019
@k8s-ci-robot k8s-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Mar 20, 2019
@chrisz100
Copy link
Contributor

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Mar 20, 2019
@ryan-dyer
Copy link
Contributor

I'm not sure this is a good idea. If I'm not mistaken, etcd operates via quorum. In the case of 3 etcd in 2 AZ, if the AZ hosting 2 instances goes out, then you've lost quorum. I believe the intent of kops HA design is that if an AZ is lost, the cluster doesnt go out. Operating in 2 AZs is not a very HA design. Perhaps an argument which ignores the check would be a better solution.

@chrisz100
Copy link
Contributor

Etcd can operate stand-alone which it would if the az with two instances fail.

Etcd is also capable to run with two nodes, just that the consensus protocol wouldn’t work and thus performance would degrade badly.

Personally I see this as quite a good approach to get a more HA etcd without being required to use more AZ

@chrisz100
Copy link
Contributor

/lgtm

It’s a small change so unsure if really suitable for 1.12 still but definitely a thing for 1.13
What do you think @justinsb ?

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 20, 2019
@adammw
Copy link
Contributor Author

adammw commented Mar 20, 2019

So the problem I was trying to solve here was to create a HA cluster in us-west-1 which only has two AZs available. However, even after solving this issue, I ran into other issues where having multiple etcd members in the same instance group, or having multiple instance groups in the same zone, just doesn't work.

@ryan-dyer
Copy link
Contributor

@chrisz100 https://coreos.com/etcd/docs/latest/op-guide/failures.html according to this, in the scenario of 1 AZ going down that has 2 instances, this would be considered a majority failure and cause the cluster to cease performing writes. I personally would not consider this to be an ideal HA scenario. I completely appreciate that in some cases (as in the authors case) it may be the best you have to work with. But I dont feel kops should lower its bar for a good HA design without the user willingly agreeing to it. And it also sounds as if there should be additional work which goes into this PR to make it work correctly in those scenarios to begin with.

@chrisz100
Copy link
Contributor

So the problem I was trying to solve here was to create a HA cluster in us-west-1 which only has two AZs available. However, even after solving this issue, I ran into other issues where having multiple etcd members in the same instance group, or having multiple instance groups in the same zone, just doesn't work.

Do you have more information about these issues?

Before this is sorted out:
/lgtm cancel

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 21, 2019
@@ -157,10 +157,11 @@ func (c *populateClusterSpec) run(clientset simple.Clientset) error {
//if clusterSubnets[zone] == nil {
// return fmt.Errorf("EtcdMembers for %q is configured in zone %q, but that is not configured at the k8s-cluster level", etcd.Name, m.Zone)
//}
etcdNames[m.Name] = m
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good fix here - we weren't actually checking for duplicate names!

etcdInstanceGroups[instanceGroupName] = m
}

if (len(etcdInstanceGroups) % 2) == 0 {
if (len(etcdNames) % 2) == 0 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could also look at the size of the etcd.Members map, but this is fine..

@justinsb
Copy link
Member

I would classify this as a bug fix, because the code wasn't checking correctly for duplicate names (for example).

However, yes, if you're putting 2 of 3 nodes in the same AZ, it's arguably not much more reliable than running non-HA.

I'm happy to go either way - on the one hand the previous checks were wrong, on the other hand it was helpfully wrong in that it stopped some configurations that probably weren't ideal.

And yes, it should work with multiple etcd members in the same group / AZ (though it gets confusing because they can mount each other's volumes). It sounds like we need a test for that case though...

@justinsb
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 25, 2019
@KashifSaadat
Copy link
Contributor

/approve

Thanks @adammw 👍

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: adammw, KashifSaadat

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 27, 2019
@k8s-ci-robot k8s-ci-robot merged commit c91bed7 into kubernetes:master Mar 27, 2019
@adammw adammw deleted the adammw/allow-uneven-etcd-zones branch March 27, 2019 16:17
k8s-ci-robot added a commit that referenced this pull request May 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants