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

single-to-multi-master doc: Create all master instances groups at first #2774

Merged
merged 1 commit into from
Jun 29, 2017

Conversation

dtan4
Copy link
Contributor

@dtan4 dtan4 commented Jun 19, 2017

Why

Current single-to-multi-master says:

  • Create the third master instance group after establishing 2-masters cluster
  • Add second and third master instance groups to .spec.etcdClusters, even if we have not created it yet.

I tried to single-to-multi master migration with the above document, but I got an the below error:

$ kops update cluster
Using cluster from kubectl context: k8s.test-cluster.wantedlyapp.com


*********************************************************************************

A new kubernetes version is available: 1.5.7
Upgrading is recommended (try kops upgrade cluster)

More information: https://github.com/kubernetes/kops/blob/master/permalinks/upgrade_k8s.md#1.5.7

*********************************************************************************


error building tasks: InstanceGroup not found (for etcd c2/main): "master-ap-northeast-1c-2"

kops update cluster does not accept nonexist instance group...

After creating the third master instance group with empty size, it worked well and I could finish migration successfully.

What

Revise document to create all master instance groups at first.


This change is Reviewable

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

Hi @dtan4. 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 @k8s-bot 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.

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. I understand the commands that are listed here.

@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 Jun 19, 2017
@chrislovecnm
Copy link
Contributor

@k8s-bot ok to test

@k8s-ci-robot k8s-ci-robot removed the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jun 19, 2017
@chrislovecnm
Copy link
Contributor

@MrTrustor can you comment on this? I have not done this before, so approving changes to the doc would need me to go through the documentation

@MrTrustor
Copy link
Contributor

I have not tested this procedure since writing this doc, so the behavior of Kops may have changed since then. The proposed changes seem reasonable enough.
@chrislovecnm Do you need me to actually test the new procedure?

@chrislovecnm
Copy link
Contributor

@MrTrustor that would be amazing if you could, no worries if you cannot. @dtan4 can you outline how you have tested this process?

@dtan4
Copy link
Contributor Author

dtan4 commented Jun 26, 2017

I've upgraded current cluster with the steps below:

1. create single-master cluster

cluster name: cluster.example.com

  • master: ap-northeast-1c
  • nodes: ap-northeast-1b, ap-northeast-1c

2. create instance groups

(ap-northeast-1 users can use 2 AZs only...)

kops create ig master-ap-northeast-1b --subnet ap-northeast-1b --role Master

# change maxSize, minSize to 0
kops create ig master-ap-northeast-1c-2 --subnet ap-northeast-1c --role Master

3. add second master

a. edit cluster

kops edit cluster

add this to both etcdMembers:

    - instanceGroup: master-ap-northeast-1b
      name: b
    - instanceGroup: master-ap-northeast-1c-2
      name: c2

b. add etcd member

etcd Pod:

$ kubectl get po --namespace kube-system | grep etcd
etcd-server-events-ip-10-1-72-52.ap-northeast-1.compute.internal        1/1       Running   0          70d
etcd-server-ip-10-1-72-52.ap-northeast-1.compute.internal               1/1       Running   0          70d
kubectl --namespace=kube-system exec etcd-server-ip-10-1-72-52.ap-northeast-1.compute.internal -- etcdctl member add etcd-b http://etcd-b.internal.cluster.example.com:2380
kubectl --namespace=kube-system exec etcd-server-events-ip-10-1-72-52.ap-northeast-1.compute.internal -- etcdctl --endpoint http://127.0.0.1:4002 member add etcd-events-b http://etcd-events-b.internal.cluster.example.com:2381

c. update cluster

kops update cluster --yes

d. update etcd in new master

ssh -i ~/.ssh/key.rsa admin@<new master>
sudo -i
systemctl stop kubelet
systemctl stop protokube
sudo vim /etc/kubernetes/manifests/etcd-events.manifest
sudo vim /etc/kubernetes/manifests/etcd.manifest
docker stop $(docker ps | grep "etcd:2.2.1" | awk '{print $1}')
rm -r /mnt/<id>/var/etcd/data-events/member/
rm -r /mnt/<id>/var/etcd/data/member/
systemctl start kubelet
exit
exit

4. add third master

a. increase ASG size of third-master instance group

# increase minSize and maxSize to 1
kops edit ig master-ap-northeast-1c-2

b. add etcd member

kubectl --namespace=kube-system exec etcd-server-ip-10-1-89-92.ap-northeast-1.compute.internal -- etcdctl member add etcd-c2 http://etcd-c2.internal.cluster.example.com:2380
kubectl --namespace=kube-system exec etcd-server-events-ip-10-1-89-92.ap-northeast-1.compute.internal -- etcdctl --endpoint http://127.0.0.1:4002 member add etcd-events-c2 http://etcd-events-c2.internal.cluster.example.com:2381

c. update cluster

kops update cluster --yes

d. update etcd in new master

ssh -i ~/.ssh/key.rsa admin@<new master>
sudo -i
systemctl stop kubelet
systemctl stop protokube
sudo vim /etc/kubernetes/manifests/etcd-events.manifest
sudo vim /etc/kubernetes/manifests/etcd.manifest
docker stop $(docker ps | grep "etcd:2.2.1" | awk '{print $1}')
rm -r /mnt/<id>/var/etcd/data-events/member/
rm -r /mnt/<id>/var/etcd/data/member/
systemctl start kubelet
exit
exit

@chrislovecnm
Copy link
Contributor

Thanks, @dtan4, let's get this in an iterate

Copy link
Contributor

@chrislovecnm chrislovecnm left a comment

Choose a reason for hiding this comment

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

Thanks

@chrislovecnm chrislovecnm merged commit 69e5bea into kubernetes:master Jun 29, 2017
@dtan4 dtan4 deleted the single-to-multi-detail branch August 31, 2017 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants