|
| 1 | +<!-- START doctoc generated TOC please keep comment here to allow auto update --> |
| 2 | +<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> |
| 3 | +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* |
| 4 | + |
| 5 | +- [Pre-condition](#pre-condition) |
| 6 | +- [Install openstack providers into target cluster](#install-openstack-providers-into-target-cluster) |
| 7 | +- [Move objects in `bootstrap` cluster into `target` cluster.](#move-objects-in-bootstrap-cluster-into-target-cluster) |
| 8 | +- [Create secret in `target` cluster](#create-secret-in-target-cluster) |
| 9 | +- [Check cluster status](#check-cluster-status) |
| 10 | + |
| 11 | +<!-- END doctoc generated TOC please keep comment here to allow auto update --> |
| 12 | + |
| 13 | +This documenation describes how to move `Cluster API` related objects from `bootstrap` cluster to `target` cluster. Check [clusterctl move](https://cluster-api.sigs.k8s.io/clusterctl/commands/move.html) for further information. |
| 14 | + |
| 15 | +# Pre-condition |
| 16 | + |
| 17 | +Bootstrap cluster |
| 18 | +``` |
| 19 | +# kubectl get pods --all-namespaces |
| 20 | +NAMESPACE NAME READY STATUS RESTARTS AGE |
| 21 | +capi-kubeadm-bootstrap-system capi-kubeadm-bootstrap-controller-manager-68cfd4c5b8-mjq75 2/2 Running 0 27m |
| 22 | +capi-kubeadm-control-plane-system capi-kubeadm-control-plane-controller-manager-848575ccb7-m672j 2/2 Running 0 27m |
| 23 | +capi-system capi-controller-manager-564d97d59c-2t7sl 2/2 Running 0 27m |
| 24 | +capi-webhook-system capi-controller-manager-9c8b5d6d4-49czx 2/2 Running 0 28m |
| 25 | +capi-webhook-system capi-kubeadm-bootstrap-controller-manager-7dff4b8c7-8w9sq 2/2 Running 1 27m |
| 26 | +capi-webhook-system capi-kubeadm-control-plane-controller-manager-74c99998d-bftbn 2/2 Running 0 27m |
| 27 | +capi-webhook-system capo-controller-manager-7d7bfc856b-5ttw6 2/2 Running 0 24m |
| 28 | +capo-system capo-controller-manager-5fb48fcb4c-ttkpv 2/2 Running 0 25m |
| 29 | +cert-manager cert-manager-544d659678-l9pjb 1/1 Running 0 29m |
| 30 | +cert-manager cert-manager-cainjector-64c9f978d7-bjxkg 1/1 Running 0 29m |
| 31 | +cert-manager cert-manager-webhook-5855bb8c8c-8hb9w 1/1 Running 0 29m |
| 32 | +kube-system coredns-66bff467f8-ggn54 1/1 Running 0 40m |
| 33 | +kube-system coredns-66bff467f8-t4bqr 1/1 Running 0 40m |
| 34 | +kube-system etcd-kind-control-plane 1/1 Running 1 40m |
| 35 | +kube-system kindnet-ng2gf 1/1 Running 0 40m |
| 36 | +kube-system kube-apiserver-kind-control-plane 1/1 Running 1 40m |
| 37 | +kube-system kube-controller-manager-kind-control-plane 1/1 Running 1 40m |
| 38 | +kube-system kube-proxy-h6rmz 1/1 Running 0 40m |
| 39 | +kube-system kube-scheduler-kind-control-plane 1/1 Running 1 40m |
| 40 | +local-path-storage local-path-provisioner-bd4bb6b75-ft7wh 1/1 Running 0 40m |
| 41 | +``` |
| 42 | + |
| 43 | +Target cluster (Below is an example of external cloud provider) |
| 44 | +``` |
| 45 | +# kubectl get pods --kubeconfig capi-openstack-3.kubeconfig --all-namespaces |
| 46 | +NAMESPACE NAME READY STATUS RESTARTS AGE |
| 47 | +kube-system calico-kube-controllers-59b699859f-djqd7 1/1 Running 0 6m2s |
| 48 | +kube-system calico-node-szp44 1/1 Running 0 6m2s |
| 49 | +kube-system calico-node-xhgzr 1/1 Running 0 6m2s |
| 50 | +kube-system coredns-6955765f44-wk2vq 1/1 Running 0 21m |
| 51 | +kube-system coredns-6955765f44-zhps9 1/1 Running 0 21m |
| 52 | +kube-system etcd-capi-openstack-control-plane-82xck 1/1 Running 0 22m |
| 53 | +kube-system kube-apiserver-capi-openstack-control-plane-82xck 1/1 Running 0 22m |
| 54 | +kube-system kube-controller-manager-capi-openstack-control-plane-82xck 1/1 Running 2 22m |
| 55 | +kube-system kube-proxy-4f9k8 1/1 Running 0 21m |
| 56 | +kube-system kube-proxy-gjd55 1/1 Running 0 21m |
| 57 | +kube-system kube-scheduler-capi-openstack-control-plane-82xck 1/1 Running 2 22m |
| 58 | +kube-system openstack-cloud-controller-manager-z9jtc 1/1 Running 1 4m9s |
| 59 | +``` |
| 60 | + |
| 61 | +# Install OpenStack Cluster API provider into target cluster |
| 62 | + |
| 63 | +You need install OpenStack cluster api providers into `target` cluster first. |
| 64 | +``` |
| 65 | +# clusterctl --kubeconfig capi-openstack-3.kubeconfig init --infrastructure openstack |
| 66 | +Fetching providers |
| 67 | +Installing cert-manager |
| 68 | +Waiting for cert-manager to be available... |
| 69 | +Installing Provider="cluster-api" Version="v0.3.8" TargetNamespace="capi-system" |
| 70 | +Installing Provider="bootstrap-kubeadm" Version="v0.3.8" TargetNamespace="capi-kubeadm-bootstrap-system" |
| 71 | +Installing Provider="control-plane-kubeadm" Version="v0.3.8" TargetNamespace="capi-kubeadm-control-plane-system" |
| 72 | +Installing Provider="infrastructure-openstack" Version="v0.3.1" TargetNamespace="capo-system" |
| 73 | +
|
| 74 | +Your management cluster has been initialized successfully! |
| 75 | +
|
| 76 | +You can now create your first workload cluster by running the following: |
| 77 | +
|
| 78 | + clusterctl config cluster [name] --kubernetes-version [version] | kubectl apply -f - |
| 79 | +``` |
| 80 | + |
| 81 | +# Move objects from `bootstrap` cluster into `target` cluster. |
| 82 | + |
| 83 | +CRD, objects such as `OpenStackCluster`, `OpenStackMachine` etc need to be moved. |
| 84 | +``` |
| 85 | +# clusterctl move --to-kubeconfig capi-openstack-3.kubeconfig -v 10 |
| 86 | +No default config file available |
| 87 | +Performing move... |
| 88 | +Discovering Cluster API objects |
| 89 | +Cluster Count=1 |
| 90 | +KubeadmConfig Count=2 |
| 91 | +KubeadmConfigTemplate Count=1 |
| 92 | +KubeadmControlPlane Count=1 |
| 93 | +MachineDeployment Count=1 |
| 94 | +Machine Count=2 |
| 95 | +MachineSet Count=1 |
| 96 | +OpenStackCluster Count=1 |
| 97 | +OpenStackMachine Count=2 |
| 98 | +OpenStackMachineTemplate Count=2 |
| 99 | +Secret Count=9 |
| 100 | +Total objects Count=23 |
| 101 | +Moving Cluster API objects Clusters=1 |
| 102 | +Pausing the source cluster |
| 103 | +Set Cluster.Spec.Paused Paused=true Cluster="capi-openstack-3" Namespace="default" |
| 104 | +Creating target namespaces, if missing |
| 105 | +Creating objects in the target cluster |
| 106 | +Creating Cluster="capi-openstack-3" Namespace="default" |
| 107 | +Creating OpenStackMachineTemplate="capi-openstack-control-plane" Namespace="default" |
| 108 | +Creating OpenStackMachineTemplate="capi-openstack-md-0" Namespace="default" |
| 109 | +Creating OpenStackCluster="capi-openstack-3" Namespace="default" |
| 110 | +Creating KubeadmConfigTemplate="capi-openstack-md-0" Namespace="default" |
| 111 | +Creating MachineDeployment="capi-openstack-md-0" Namespace="default" |
| 112 | +Creating KubeadmControlPlane="capi-openstack-control-plane" Namespace="default" |
| 113 | +Creating Secret="capi-openstack-3-etcd" Namespace="default" |
| 114 | +Creating Machine="capi-openstack-control-plane-n2kdq" Namespace="default" |
| 115 | +Creating Secret="capi-openstack-3-sa" Namespace="default" |
| 116 | +Creating Secret="capi-openstack-3-kubeconfig" Namespace="default" |
| 117 | +Creating Secret="capi-openstack-3-proxy" Namespace="default" |
| 118 | +Creating MachineSet="capi-openstack-md-0-dfdf94979" Namespace="default" |
| 119 | +Creating Secret="capi-openstack-3-ca" Namespace="default" |
| 120 | +Creating Machine="capi-openstack-md-0-dfdf94979-656zq" Namespace="default" |
| 121 | +Creating KubeadmConfig="capi-openstack-control-plane-xzj7x" Namespace="default" |
| 122 | +Creating OpenStackMachine="capi-openstack-control-plane-82xck" Namespace="default" |
| 123 | +Creating Secret="capi-openstack-control-plane-xzj7x" Namespace="default" |
| 124 | +Creating OpenStackMachine="capi-openstack-md-0-bkwhh" Namespace="default" |
| 125 | +Creating KubeadmConfig="capi-openstack-md-0-t44gj" Namespace="default" |
| 126 | +Creating Secret="capi-openstack-md-0-t44gj" Namespace="default" |
| 127 | +Deleting objects from the source cluster |
| 128 | +Deleting Secret="capi-openstack-md-0-t44gj" Namespace="default" |
| 129 | +Deleting Secret="capi-openstack-control-plane-xzj7x" Namespace="default" |
| 130 | +Deleting OpenStackMachine="capi-openstack-md-0-bkwhh" Namespace="default" |
| 131 | +Deleting KubeadmConfig="capi-openstack-md-0-t44gj" Namespace="default" |
| 132 | +Deleting Machine="capi-openstack-md-0-dfdf94979-656zq" Namespace="default" |
| 133 | +Deleting KubeadmConfig="capi-openstack-control-plane-xzj7x" Namespace="default" |
| 134 | +Deleting OpenStackMachine="capi-openstack-control-plane-82xck" Namespace="default" |
| 135 | +Deleting Secret="capi-openstack-3-etcd" Namespace="default" |
| 136 | +Deleting Machine="capi-openstack-control-plane-n2kdq" Namespace="default" |
| 137 | +Deleting Secret="capi-openstack-3-sa" Namespace="default" |
| 138 | +Deleting Secret="capi-openstack-3-kubeconfig" Namespace="default" |
| 139 | +Deleting Secret="capi-openstack-3-proxy" Namespace="default" |
| 140 | +Deleting MachineSet="capi-openstack-md-0-dfdf94979" Namespace="default" |
| 141 | +Deleting Secret="capi-openstack-3-ca" Namespace="default" |
| 142 | +Deleting OpenStackMachineTemplate="capi-openstack-control-plane" Namespace="default" |
| 143 | +Deleting OpenStackMachineTemplate="capi-openstack-md-0" Namespace="default" |
| 144 | +Deleting OpenStackCluster="capi-openstack-3" Namespace="default" |
| 145 | +Deleting KubeadmConfigTemplate="capi-openstack-md-0" Namespace="default" |
| 146 | +Deleting MachineDeployment="capi-openstack-md-0" Namespace="default" |
| 147 | +Deleting KubeadmControlPlane="capi-openstack-control-plane" Namespace="default" |
| 148 | +Deleting Cluster="capi-openstack-3" Namespace="default" |
| 149 | +Resuming the target cluster |
| 150 | +Set Cluster.Spec.Paused Paused=false Cluster="capi-openstack-3" Namespace="default" |
| 151 | +``` |
| 152 | +# Check cluster status |
| 153 | + |
| 154 | +``` |
| 155 | +# kubectl get openstackcluster --kubeconfig capi-openstack-3.kubeconfig --all-namespaces |
| 156 | +NAMESPACE NAME CLUSTER READY NETWORK SUBNET |
| 157 | +default capi-openstack-3 capi-openstack-3 true 4a6f2d57-bb3d-44f4-a28a-4c94a92e41d0 1a1a1d9d-5258-42cb-8756-fa4c648af72b |
| 158 | +
|
| 159 | +# kubectl get openstackmachines --kubeconfig capi-openstack-3.kubeconfig --all-namespaces |
| 160 | +NAMESPACE NAME CLUSTER STATE READY INSTANCEID MACHINE |
| 161 | +default capi-openstack-control-plane-82xck capi-openstack-3 ACTIVE true openstack://f29007c5-f672-4214-a508-b7cf4a17b3ed capi-openstack-control-plane-n2kdq |
| 162 | +default capi-openstack-md-0-bkwhh capi-openstack-3 ACTIVE true openstack://6e23324d-315a-4d75-85a9-350fd1705ab6 capi-openstack-md-0-dfdf94979-656zq |
| 163 | +``` |
0 commit comments