{"id":37163872,"url":"https://github.com/spectrocloud/cluster-api-bootstrap-provider-microk8s","last_synced_at":"2026-01-14T19:28:57.938Z","repository":{"id":103555114,"uuid":"543256154","full_name":"spectrocloud/cluster-api-bootstrap-provider-microk8s","owner":"spectrocloud","description":"This project offers a cluster API bootstrap provider controller that manages the node provision of a MicroK8s cluster.","archived":false,"fork":true,"pushed_at":"2025-10-17T11:52:49.000Z","size":16564,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-11-01T15:20:49.889Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://microk8s.io","language":"Go","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"canonical/cluster-api-bootstrap-provider-microk8s","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/spectrocloud.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2022-09-29T18:01:41.000Z","updated_at":"2022-10-12T04:32:31.000Z","dependencies_parsed_at":"2023-10-16T04:14:42.990Z","dependency_job_id":"7ef7a1a4-f9bc-4c4c-97a4-73f8d58a6c9f","html_url":"https://github.com/spectrocloud/cluster-api-bootstrap-provider-microk8s","commit_stats":null,"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"purl":"pkg:github/spectrocloud/cluster-api-bootstrap-provider-microk8s","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spectrocloud%2Fcluster-api-bootstrap-provider-microk8s","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spectrocloud%2Fcluster-api-bootstrap-provider-microk8s/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spectrocloud%2Fcluster-api-bootstrap-provider-microk8s/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spectrocloud%2Fcluster-api-bootstrap-provider-microk8s/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spectrocloud","download_url":"https://codeload.github.com/spectrocloud/cluster-api-bootstrap-provider-microk8s/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spectrocloud%2Fcluster-api-bootstrap-provider-microk8s/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28432612,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T18:57:19.464Z","status":"ssl_error","status_checked_at":"2026-01-14T18:52:48.501Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-14T19:28:57.040Z","updated_at":"2026-01-14T19:28:57.927Z","avatar_url":"https://github.com/spectrocloud.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Cluster API bootstrap provider for MicroK8s\n\n[Cluster API](https://cluster-api.sigs.k8s.io/) provides declarative APIs to provision, upgrade, and operate Kubernetes clusters.\n\nThe [bootstrap provider controller in cluster API](https://cluster-api.sigs.k8s.io/user/concepts.html#bootstrap-provider) is responsible for initializing the control plane and worker nodes of the provisioned cluster.\n\nThis project offers a cluster API bootstrap provider controller that manages the node provision of a [MicroK8s](https://github.com/canonical/microk8s) cluster. It is expected to be used along with the respective [MicroK8s specific control plane provider](https://github.com/canonical/cluster-api-control-plane-provider-microk8s).\n\n### Prerequisites\n\n  * Install clusterctl following the [upstream instructions](https://cluster-api.sigs.k8s.io/user/quick-start.html#install-clusterctl)\n```\ncurl -L https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.1.3/clusterctl-linux-amd64 -o clusterctl\n```\n\n  * Install a bootstrap Kubernetes cluster. To use MicroK8s as a bootstrap cluster:\n```\nsudo snap install microk8s --classic\nsudo microk8s.config  \u003e ~/.kube/config\nsudo microk8s enable dns\n```\n\n### Installation\n\nTo to configure clusterctl with the two MicroK8s providers edit `~/.cluster-api/clusterctl.yaml`\nand add the following:\n```\nproviders:\n  - name: \"microk8s\"\n    url: \"https://github.com/canonical/cluster-api-bootstrap-provider-microk8s/releases/latest/bootstrap-components.yaml\"\n    type: \"BootstrapProvider\"\n  - name: \"microk8s\"\n    url: \"https://github.com/canonical/cluster-api-control-plane-provider-microk8s/releases/latest/control-plane-components.yaml\"\n    type: \"ControlPlaneProvider\"\n```\n\nYou will now be able now to initialize clusterctl with the MicroK8s providers:\n\n```\nclusterctl init --bootstrap microk8s --control-plane microk8s -i \u003cinfra-provider-of-choice\u003e\n```\n\nAlternatively, you can build the providers manually as described in the following section.\n\n\n\n### Building from source\n\n  * Install the cluster provider of your choice. Have a look at the [cluster API book](https://cluster-api.sigs.k8s.io/user/quick-start.html#initialization-for-common-providers) for your options at this step. You should deploy only the infrastructure controller leaving the bootstrap and control plane ones empty. For example assuming we want to provision a MicroK8s cluster on AWS:\n```\nclusterctl init --infrastructure aws --bootstrap \"-\" --control-plane \"-\"\n```\n\n  * Clone the two cluster API MicroK8s specific repositories and start the controllers on two separate terminals:\n```\ncd $GOPATH/src/github.com/canonical/cluster-api-bootstrap-provider-microk8s/\nmake install\nmake run\n```\nAnd:\n```\ncd $GOPATH/src/github.com/canonical/cluster-api-control-plane-provider-microk8s/\nmake install\nmake run\n```\n\n### Usage\n\nAs soon as the bootstrap and control-plane controllers are up and running you can apply the cluster manifests describing the desired specs of the cluster you want to provision. Each machine is associated with a MicroK8sConfig through which you can set the cluster's properties. Please review  the available options in [the respective definitions file](./apis/v1beta1/microk8sconfig_types.go). You may also find useful the example manifests found under the [examples](./examples/) directory. Note that the configuration structure followed is similar to the the one of kubeadm, in the MicroK8sConfig you will find a CLusterConfiguration and an InitConfiguration sections. When targeting a specific infrastructure you should be aware of which ports are used by MicroK8s and allow them in the network security groups on your deployment.\n\nTwo workload cluster templates are available under the [templates](./templates/) folder, which are actively used to validate releases:\n- [AWS](./templates/cluster-template-aws.yaml), using the [AWS Infrastructure Provider](https://github.com/kubernetes-sigs/cluster-api-provider-aws)\n- [OpenStack](./templates/cluster-template-openstack.yaml), using the [OpenStack Infrastructure Provider](https://github.com/kubernetes-sigs/cluster-api-provider-openstack)\n\nBefore generating a cluster, ensure that you have followed the instructions to set up the infrastructure provider that you will use.\n\n#### AWS\n\n\u003e *NOTE*: Ensure that you have properly deployed the AWS infrastructure provider prior to executing the commands below. See [Initialization for common providers](https://cluster-api.sigs.k8s.io/user/quick-start.html#initialization-for-common-providers)\n\nGenerate a cluster template with:\n\n```bash\n# review list of variables needed for the cluster template\nclusterctl generate cluster microk8s-aws --from ./templates/cluster-template-aws.yaml --list-variables\n\n# set environment variables (edit the file as needed before sourcing it)\nsource ./templates/cluster-template-aws.rc\n\n# generate cluster\nclusterctl generate cluster microk8s-aws --from ./templates/cluster-template-aws.yaml \u003e cluster-aws.yaml\n```\n\nThen deploy the cluster with:\n\n```bash\nmicrok8s kubectl apply -f cluster-aws.yaml\n```\n\nThe MicroK8s cluster will be deployed shortly afterwards. You can see the provisioned machines with:\n\n```bash\n# microk8s kubectl get machines\nNAME                                 CLUSTER        NODENAME          PROVIDERID                              PHASE     AGE   VERSION\nmicrok8s-aws-control-plane-wd94k     microk8s-aws   ip-10-0-95-69     aws:///us-east-1a/i-0051fa0d99ae18e43   Running   10m   v1.23.0\nmicrok8s-aws-md-0-766784ddc4-75m6q   microk8s-aws   ip-10-0-120-139   aws:///us-east-1a/i-0eb890a181c9b8215   Running   14m   v1.23.0\nmicrok8s-aws-control-plane-nkx2b     microk8s-aws   ip-10-0-218-228   aws:///us-east-1c/i-0a28bd5ac4ee1ce5d   Running   10m   v1.23.0\nmicrok8s-aws-control-plane-f4tp2     microk8s-aws   ip-10-0-100-255   aws:///us-east-1a/i-0280ea368cd050dd2   Running   10m   v1.23.0\nmicrok8s-aws-md-0-766784ddc4-n8csl   microk8s-aws   ip-10-0-69-166    aws:///us-east-1a/i-01cbbd4c07df2eb8c   Running   14m   v1.23.0\n```\n\nWith clusterctl you can then retrieve the kubeconfig file for the workload cluster:\n\n```bash\nclusterctl get kubeconfig microk8s-aws \u003e kubeconfig\n```\n\nAnd then use it to access the cluster:\n\n```bash\n# KUBECONFIG=./kubeconfig kubectl get node\nNAME              STATUS   ROLES    AGE     VERSION\nip-10-0-95-69     Ready    \u003cnone\u003e   9m11s   v1.23.9-2+88a2c6a14e7008\nip-10-0-120-139   Ready    \u003cnone\u003e   2m45s   v1.23.9-2+88a2c6a14e7008\nip-10-0-69-166    Ready    \u003cnone\u003e   2m22s   v1.23.9-2+88a2c6a14e7008\nip-10-0-100-255   Ready    \u003cnone\u003e   108s    v1.23.9-2+88a2c6a14e7008\nip-10-0-218-228   Ready    \u003cnone\u003e   110s    v1.23.9-2+88a2c6a14e7008\n```\n\nTo discard the cluster, delete the `microk8s-aws` cluster.\n\n```bash\nmicrok8s kubectl delete cluster microk8s-aws\n```\n\n\u003e *NOTE*: This command might take a while, because it ensures that the providers properly clean up any resources (Virtual Machines, Load Balancers, etc) that were provisioned while setting up the cluster\n\n... and also the secrets created:\n\n```bash\n# microk8s kubectl delete secret microk8s-aws-jointoken  microk8s-aws-ca  microk8s-aws-kubeconfig\nsecret \"microk8s-aws-jointoken\" deleted\nsecret \"microk8s-aws-ca\" deleted\nsecret \"microk8s-aws-kubeconfig\" deleted\n```\n\n**Note:** if you want to provide your own CA and/or the join token used to form a cluster you will need to create the respective secrets (`\u003ccluster-name\u003e-ca` and `\u003ccluster-name\u003e-jointoken`) before applying the cluster manifests.\n\n**Note:** the default cluster template for AWS ensures that the default security groups created by the AWS infrastructure provider are sufficient for the cluster to work as expected. For more complex scenarios, you might have to configure your own security groups and set the AWSCluster spec accordingly. For more details, refer to the [upstream AWS provider documentation](https://cluster-api-aws.sigs.k8s.io/topics/bring-your-own-aws-infrastructure.html#security-groups).\n\n#### OpenStack\n\n\u003e *NOTE*: Ensure that you have properly deployed the OpenStack infrastructure provider prior to executing the commands below. See [Initialization for common providers](https://cluster-api.sigs.k8s.io/user/quick-start.html#initialization-for-common-providers)\n\nCreate a cloud-config secret for the OpenStack API in the management cluster with the following command. Make sure to replace the OpenStack credentials in the command below to match your OpenStack cloud. If unsure, consult \"Horizon\" \u003e \"API Access\" \u003e \"Download OpenStack RC File\" \u003e \"OpenStack clouds.yaml File\".\n\n```bash\nsudo microk8s kubectl create -f - \u003c\u003cEOF\napiVersion: v1\nkind: Secret\nmetadata:\n  name: cloud-config\n  labels:\n    clusterctl.cluster.x-k8s.io/move: \"true\"\nstringData:\n  cacert: ''\n  clouds.yaml: |\n    clouds:\n      openstack:\n        auth:\n          auth_url: \"${OS_AUTH_URL}\"\n          username: \"${OS_USERNAME}\"\n          password: \"${OS_PASSWORD}\"\n          project_name: \"${OS_PROJECT_NAME}\"\n          user_domain_name: \"${OS_USER_DOMAIN_NAME}\"\n          project_domain_name: \"${OS_PROJECT_DOMAIN_NAME}\"\n        region_name: \"${OS_REGION_NAME}\"\n        interface: \"public\"\n        verify: false\n        identity_api_version: 3\nEOF\n```\n\nGenerate a cluster template with:\n\n```bash\n# review list of variables needed for the cluster template\nclusterctl generate cluster microk8s-openstack --from ./templates/cluster-template-openstack.yaml --list-variables\n\n# set environment variables (edit the file as needed before sourcing it)\nsource ./templates/cluster-template-openstack.rc\n\n# generate cluster\nclusterctl generate cluster microk8s-openstack --from ./templates/cluster-template-openstack.yaml \u003e cluster-openstack.yaml\n```\n\nThen deploy the cluster with:\n\n```bash\nmicrok8s kubectl apply -f cluster-openstack.yaml\n```\n\n#### Azure\n\n\u003e *NOTE*: Ensure that you have properly deployed the Azure infrastructure provider prior to executing the commands below. See [Initialization for common providers](https://cluster-api.sigs.k8s.io/user/quick-start.html#initialization-for-common-providers)\n\nGenerate a cluster template with:\n\n```bash\n# review list of variables needed for the cluster template\nclusterctl generate cluster microk8s-azure --from ./templates/cluster-template-azure.yaml --list-variables\n\n# set environment variables (edit the file as needed before sourcing it)\nsource ./templates/cluster-template-azure.rc\n\n# generate cluster\nclusterctl generate cluster microk8s-azure --from ./templates/cluster-template-azure.yaml \u003e cluster-azure.yaml\n```\n\nThen deploy the cluster with:\n\n```bash\nmicrok8s kubectl apply -f cluster-azure.yaml\n```\n\n\u003e **Note**: Make sure you have the secret to include the password of the Service Principal identity. This secret will be referenced by the AzureClusterIdentity used by the AzureCluster.\n\n#### GCP\n\n\u003e *NOTE*: Ensure that you have properly deployed the GCP infrastructure provider prior to executing the commands below. See [Initialization for common providers](https://cluster-api.sigs.k8s.io/user/quick-start.html#initialization-for-common-providers)\n\nPrior to generate a cluster template, you need to create a VM image for use in the cluster. The MicroK8s provider works with any stock Ubuntu image. Use the Ubuntu 22.04 LTS image with:\n\n```bash\ngcloud compute images create ubuntu-2204 --source-image-project ubuntu-os-cloud --source-image-family ubuntu-2204-lts\n```\n\nMake note of the name of the image `ubuntu-2204`, which we then feed into the cluster template.\n\nGenerate a cluster template with:\n\n```bash\n# review list of variables needed for the cluster template\nclusterctl generate cluster microk8s-gcp --from ./templates/cluster-template-gcp.yaml --list-variables\n\n# set environment variables (edit the file as needed before sourcing it)\nsource ./templates/cluster-template-gcp.rc\n\n# generate the cluster\nclusterctl generate cluster microk8s-gcp --from ./templates/cluster-template-gcp.yaml \u003e cluster-gcp.yaml\n```\n\nThen, deploy the cluster with:\n\n```bash\nmicrok8s kubectl apply -f cluster-gcp.yaml\n```\n\n## Development\n\nThe two MicroK8s CAPI providers, the bootstrap and control plane, serve distinct purposes:\n\n#### The bootstrap provider\n\n  * Produce the cloudinit file for all node types: the first cluster node, the control plane nodes and the worker nodes. The cloudinit file is encoded as a secret linked to each machine. This way the infrastructure provider can proceed with the instantiation of the machine.\n\n  * The most important of the three cloudinit files is the one of the cluster's first node. Its assembly requires the bootstrap provider to have already a join token and a CA. The join token is the one used by other nodes to join the cluster and the CA is used by all cluster nodes and to also produce the admin's kubeconfig file.\n\n#### The control plane provider\n\n  * Ensure the Provider ID is set on each node. MicroK8s out of the box does not set the provider ID on any of the nodes. The control plane provider makes sure the ID is set as soon as a node is ready. The infrastructure provider sets the provider ID on each provisioned machine, the control plane provider updates the cluster nodes after matching each one of them to the respective machine. The machine to node matching is done based on their IPs.\n\n  * Produce the kubeconfig file of the provisioned cluster. To produce the kubeconfig file the controller needs to know the control plane endpoint and the CA used. The control plane endpoint is usually provided by the load balancer of the infrastructure used. The CA is generated by the bootstrap provider when the first node of the infrastructure is instantiated. The authentication method used in the kubeconfig is x509. The CA is used to sign a certificate that has \"admin\" as its common name, therefore mapped to the admin user.\n\n#### Deployment of components\n\n\u003cimg src=\"./images/deployment_diagram.svg\"\u003e\n\n#### Interactions among controllers\n\n\u003cimg src=\"./images/sequence_diagram.svg\"\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspectrocloud%2Fcluster-api-bootstrap-provider-microk8s","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspectrocloud%2Fcluster-api-bootstrap-provider-microk8s","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspectrocloud%2Fcluster-api-bootstrap-provider-microk8s/lists"}