canonical / cluster-api-bootstrap-provider-microk8s

This project offers a cluster API bootstrap provider controller that manages the node provision of a MicroK8s cluster.
https://microk8s.io
21 stars 14 forks source link

Generating MicroK8s manifests with clusterctl #76

Open lieberlois opened 12 months ago

lieberlois commented 12 months ago

Hi everybody, I tried to use the microk8s bootstrap provider together with the hetzner infrastructure provider. However when using clusterctl generate, the generated manifests used Kubeadm rather than MikroK8s. Do we need to enable feature flags to use this? Would be great if we could figure this out - I'd be happy to document this in a PR afterwards 🤭 the documentation only uses pregenerated manifests so it's not very descriptive there

Thanks in advance!

neoaggelos commented 12 months ago

Hi @lieberlois

Thank you for raising this issue. Unfortunately, having a cluster template is typically the work of an infrastructure provider. Seeing as this is a bootstrap provider, even if we added cluster-templates in our releases, they would be ignored by clusterctl.

Note, however, that there are multiple cluster templates for existing infrastructures in https://github.com/canonical/cluster-api-bootstrap-provider-microk8s/tree/main/templates, currently supporting AWS, Azure, GCP and OpenStack (with more expected to be added).

There is no cluster template available at the moment for Hetzner. The way forward would be to get the default cluster template from the hetzner infrastructure provider, and then adjust it to use a MicroK8sControlPlane instead. The existing templates might be enough to get started, though there could be issues (e.g. if no LoadBalancer is available, you have to adjust the templates to include something like kube-vip).

We are not currently working on this, but would be more than happy to help if you are interested to contribute! For ongoing discussion, we can either use the issue, or use the Kubernetes Slack #microk8s channel for more direct back and forth.

Hope this helps, thanks!

syncronize-issues-to-jira[bot] commented 12 months ago

.github/.jira_sync_config.yaml file was not found

lieberlois commented 12 months ago

Thanks @neoaggelos ,

so just to summarize: the clusterctl generate functionality doesn't take bootstrap providers into consideration and hence can't generate e.g. a control plane with a custom control plane provider. If we want to use a custom one, we have to write the according custom resource objects ourselves?

Cheers, Luis

neoaggelos commented 12 months ago

Hi @lieberlois

Essentially yes. The good thing is that clusterctl can use a local file as the cluster template, and you can find existing templates in https://github.com/canonical/cluster-api-bootstrap-provider-microk8s/tree/main/templates

Example usage for example for OpenStack could be (see also README.md):

git clone https://github.com/canonical/cluster-api-bootstrap-provider-microk8s
cd cluster-api-bootstrap-provider-microk8s
clusterctl generate microk8s-openstack --from ./templates/cluster-template-openstack.yaml > cluster-openstack.yaml

There is indeed no existing tooling to get a cluster-template from the infrastructure provider https://github.com/syself/cluster-api-provider-hetzner/releases/download/v1.0.0-beta.20/cluster-template.yaml and convert it to use MicroK8s. Essentially, you have to manually strip out the KubeadmControlPlane resources and replace it with MicroK8sControlPlane etc.

rgarcia commented 3 months ago

FWIW I have a Hetzner template working and have opened a PR: https://github.com/canonical/cluster-api-bootstrap-provider-microk8s/pull/106

bg-automation commented 3 months ago

Hello Team, I faced with the same issue, but for Oracle OCI Cloud. Would be great to have one more "popular" provider for microk8s