syself / cluster-api-provider-hetzner

Cluster API Provider Hetzner :rocket: The best way to manage Kubernetes clusters on Hetzner, fully declarative, Kubernetes-native and with self-healing capabilities
https://caph.syself.com
Apache License 2.0
606 stars 57 forks source link

Upgrade controlplane to a more powerful node #121

Closed FischerLGLN closed 2 years ago

FischerLGLN commented 2 years ago

/kind bug

Hi, I am asking myself, what would be the best way to upgrade the control plane server? cx21 -> cx31

I've created a helm chart for this:

Before

control_plane_machine_count: 1
hcloud_control_plane_machine_type: cx21

After

control_plane_machine_count: 1
hcloud_control_plane_machine_type: cx31

But upgrade of the helm chart had not the intended effect of migrating everything to a cx31 server.

Environment:

batistein commented 2 years ago

Please have a look on this helm chart: https://github.com/syself/charts/blob/main/charts/capi-cr/templates/controlplane.cluster.x-k8s.io/kubeadm_control_plane.yaml#L18 Here you will see that a new HcloudMachineTemplate is created and the reference is changed. In general more information on: https://cluster-api.sigs.k8s.io/tasks/upgrading-clusters.html#upgrading-the-control-plane-machines

FischerLGLN commented 2 years ago

@batistein Thanks for the quick answer. I haven't picked your helm chart yet, because the templates are older than the templates from cluster-api generate. Nice article, I'll try out and increment the KubeadmControlPlane spec version :+1:

FischerLGLN commented 2 years ago

@batistein Okay, I fetched the HCloudMachineTemplate from the cluster.

testcluster-control-plane.yaml

then I renamed the Object to name testcluster-control-plane2 and changed the image to type: cx31

I applied the resource to the cluster.

After that I changed KubeadmControlPlane to point with the infrastructureRef to the new HcloudMachineTemplate testcluster-control-plane2.

After that it worked!

batistein commented 2 years ago

Thank you very much for the feedback! I will close that issue then.