Created
January 8, 2019 01:28
-
-
Save Oats87/2c12546ad6a43da83d4cd48bcf3acf6f to your computer and use it in GitHub Desktop.
Steps for migrating a single-node 2.1.x installation to HA
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker run -d --restart unless-stopped --name rancher -p 80:80 -p 443:443 -v /host/rancher:/var/lib/rancher rancher/rancher:v2.1.5 | |
docker exec -it rancher /bin/bash | |
# cd /var/lib/rancher | |
# tar -zcvf pki.bundle.tar.gz -C /etc/kubernetes/ssl . | |
# cp -r /etc/kubernetes/ssl . | |
# exit | |
docker run --net=container:$(docker ps | grep rancher | awk '{print $1}') -it --volumes-from rancher rancher/rke-tools:v0.1.20 | |
# ETCDCTL_API=3 etcdctl --endpoints=127.0.0.1:2379 --cacert=/var/lib/rancher/ssl/kube-ca.pem --cert=/var/lib/rancher/ssl/kube-etcd-127-0-0-1.pem --key=/var/lib/rancher/ssl/kube-etcd-127-0-0-1-key.pem snapshot save /var/lib/rancher/single-node-snapshot | |
# exit | |
exit | |
scp -r [email protected]:/host/rancher/pki.bundle.tar.gz . | |
scp -r [email protected]:/host/rancher/single-node-snapshot . | |
ssh [email protected] # new node | |
mkdir -p /opt/rke/etcd-snapshots | |
scp single-node-snapshot [email protected]:/opt/rke/etcd-snapshots/ | |
scp pki.bundle.tar.gz [email protected]:/opt/rke/etcd-snapshots/ | |
### You must create a new cluster.yml with your new desired node in it | |
rke etcd snapshot-restore --name single-node-snapshot | |
rke up | |
export KUBECONFIG=$(pwd)/kube_config_cluster.yml | |
kubectl -n kube-system create serviceaccount tiller | |
kubectl create clusterrolebinding tiller \ | |
--clusterrole cluster-admin \ | |
--serviceaccount=kube-system:tiller | |
helm init --service-account tiller | |
helm repo add rancher-stable https://releases.rancher.com/server-charts/stable | |
helm repo update | |
helm install stable/cert-manager --name cert-manager --namespace kube-system | |
helm install rancher-stable/rancher --name rancher --namespace cattle-system --set hostname=ck-sn2ha.fe.rancher.space |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment