{"id":15516218,"url":"https://github.com/dippynark/cluster-api-provider-kubernetes","last_synced_at":"2025-04-23T03:28:51.703Z","repository":{"id":53156754,"uuid":"228076658","full_name":"dippynark/cluster-api-provider-kubernetes","owner":"dippynark","description":"A Cluster API Infrastructure Provider implementation using Kubernetes itself as the infrastructure","archived":false,"fork":false,"pushed_at":"2021-04-05T13:21:04.000Z","size":1053,"stargazers_count":34,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-29T21:41:21.395Z","etag":null,"topics":["cluster-api","infrastructure-provider"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dippynark.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}},"created_at":"2019-12-14T19:22:57.000Z","updated_at":"2023-11-23T02:50:03.000Z","dependencies_parsed_at":"2022-09-12T01:00:16.584Z","dependency_job_id":null,"html_url":"https://github.com/dippynark/cluster-api-provider-kubernetes","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dippynark%2Fcluster-api-provider-kubernetes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dippynark%2Fcluster-api-provider-kubernetes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dippynark%2Fcluster-api-provider-kubernetes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dippynark%2Fcluster-api-provider-kubernetes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dippynark","download_url":"https://codeload.github.com/dippynark/cluster-api-provider-kubernetes/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250364267,"owners_count":21418453,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["cluster-api","infrastructure-provider"],"created_at":"2024-10-02T10:06:09.497Z","updated_at":"2025-04-23T03:28:51.686Z","avatar_url":"https://github.com/dippynark.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Kubernetes Cluster API Provider Kubernetes\n\nThe [Cluster API](https://github.com/kubernetes-sigs/cluster-api) brings declarative,\nKubernetes-style APIs to cluster creation, configuration and management.\n\nThis project is a [Cluster API Infrastructure\nProvider](https://cluster-api.sigs.k8s.io/reference/providers.html#infrastructure) implementation\nusing Kubernetes itself to provide the infrastructure. Pods using the\n[kindest/node](https://hub.docker.com/r/kindest/node/) image built for\n[kind](https://github.com/kubernetes-sigs/kind) are created and configured to serve as Nodes which\nform a cluster.\n\nThe primary use cases for this project are testing and experimentation.\n\n## Quickstart\n\nWe will deploy a Kubernetes cluster to provide the infrastructure, install the Cluster API\ncontrollers and configure an example Kubernetes cluster using the Cluster API and the Kubernetes\ninfrastructure provider. We will refer to the infrastructure cluster as the outer cluster and the\nCluster API cluster as the inner cluster.\n\n### Infrastructure\n\nAny recent Kubernetes cluster (1.16+) should be suitable for the outer cluster.\n\nWe are going to use [Calico](https://docs.projectcalico.org/v3.11/getting-started/kubernetes/) as an\noverlay implementation for the inner cluster with [IP-in-IP\nencapsulation](https://docs.projectcalico.org/v3.11/getting-started/kubernetes/installation/config-options#configuring-ip-in-ip)\nenabled so that our outer cluster does not need to know about the inner cluster's Pod IP range. To\nmake this work we need to ensure that the `ipip` kernel module is loadable and that IPv4\nencapsulated packets are forwarded by the kernel.\n\nOn GKE this can be accomplished as follows:\n\n```sh\n# The GKE Ubuntu image includes the ipip kernel module\n# Calico handles loading the module if necessary\n# https://github.com/projectcalico/felix/blob/9469e77e0fa530523be915dfaa69cc42d30b8317/dataplane/linux/ipip_mgr.go#L107-L110\nMANAGEMENT_CLUSTER_NAME=\"management\"\ngcloud container clusters create $MANAGEMENT_CLUSTER_NAME \\\n  --image-type=UBUNTU \\\n  --machine-type=n1-standard-2\n\n# Allow IP-in-IP traffic between outer cluster Nodes from inner cluster Pods\nCLUSTER_CIDR=`gcloud container clusters describe $MANAGEMENT_CLUSTER_NAME --format=\"value(clusterIpv4Cidr)\"`\ngcloud compute firewall-rules create allow-$MANAGEMENT_CLUSTER_NAME-cluster-pods-ipip \\\n  --source-ranges=$CLUSTER_CIDR \\\n  --allow=ipip\n\n# Forward IPv4 encapsulated packets\nkubectl apply -f hack/forward-ipencap.yaml\n```\n\n### Installation\n\n```sh\n# Install clusterctl\n# https://cluster-api.sigs.k8s.io/user/quick-start.html#install-clusterctl\nCLUSTER_API_VERSION=v0.3.15\ncurl -L https://github.com/kubernetes-sigs/cluster-api/releases/download/$CLUSTER_API_VERSION/clusterctl-`uname -s  | tr '[:upper:]' '[:lower:]'`-amd64 -o clusterctl\nchmod +x ./clusterctl\nsudo mv ./clusterctl /usr/local/bin/clusterctl\n\n# Configure the Kubernetes infrastructure provider\nmkdir -p $HOME/.cluster-api\ncat \u003e $HOME/.cluster-api/clusterctl.yaml \u003c\u003cEOF\nproviders:\n- name: kubernetes\n  url: https://github.com/dippynark/cluster-api-provider-kubernetes/releases/latest/infrastructure-components.yaml\n  type: InfrastructureProvider\nEOF\n\n# Initialise\nclusterctl init --infrastructure kubernetes\n```\n\n### Configuration\n\n```sh\nCLUSTER_NAME=\"example\"\n\n# Use ClusterIP for clusters that do not support Services of type LoadBalancer\nexport KUBERNETES_CONTROL_PLANE_SERVICE_TYPE=\"LoadBalancer\"\nexport KUBERNETES_CONTROLLER_MACHINE_CPU_REQUEST=\"500m\"\nexport KUBERNETES_CONTROLLER_MACHINE_MEMORY_REQUEST=\"1Gi\"\nexport KUBERNETES_WORKER_MACHINE_CPU_REQUEST=\"200m\"\nexport KUBERNETES_WORKER_MACHINE_MEMORY_REQUEST=\"512Mi\"\n# See kind releases for other available image versions of kindest/node\n# https://github.com/kubernetes-sigs/kind/releases\nclusterctl config cluster $CLUSTER_NAME \\\n  --infrastructure kubernetes \\\n  --kubernetes-version 1.17.0 \\\n  --control-plane-machine-count 1 \\\n  --worker-machine-count 1 \\\n  | kubectl apply -f -\n\n# Retrieve kubeconfig\nuntil [ -n \"`kubectl get secret $CLUSTER_NAME-kubeconfig -o jsonpath='{.data.value}' 2\u003e/dev/null`\" ] ; do\n  sleep 1\ndone\nkubectl get secret $CLUSTER_NAME-kubeconfig -o jsonpath='{.data.value}' | base64 --decode \u003e $CLUSTER_NAME-kubeconfig\n\n# Switch to new Kubernetes cluster. If the cluster API Server endpoint is not reachable from your\n# local machine you can exec into a controller Node (Pod) and run\n# `export KUBECONFIG=/etc/kubernetes/admin.conf` instead\nexport KUBECONFIG=$CLUSTER_NAME-kubeconfig\n\n# Wait for the API Server to come up\nuntil kubectl get nodes \u0026\u003e/dev/null; do\n  sleep 1\ndone\n\n# Install Calico. This could also be done using a ClusterResourceSet\n# https://cluster-api.sigs.k8s.io/tasks/experimental-features/cluster-resource-set.html\nkubectl apply -f https://docs.projectcalico.org/manifests/calico.yaml\n\n# Interact with your new cluster!\nkubectl get nodes\n```\n\n### Clean up\n\n```sh\nunset KUBECONFIG\nrm -f $CLUSTER_NAME-kubeconfig\nkubectl delete cluster $CLUSTER_NAME\n# If using the GKE example above\nyes | gcloud compute firewall-rules delete allow-$MANAGEMENT_CLUSTER_NAME-cluster-pods-ipip\nyes | gcloud container clusters delete $MANAGEMENT_CLUSTER_NAME --async\n```\n\n## TODO\n\n- Implement finalizer for control plane Pods to prevent deletion that'd lose quorum (i.e. PDB)\n- Work out why KCP replicas 3 has 0 failure tolerance\n  - https://github.com/kubernetes-sigs/cluster-api/blob/master/controlplane/kubeadm/controllers/remediation.go#L158-L159\n- Improve performance of control plane\n- Improve recovery of persistent control plane with 3 nodes\n  - Use Services to keep consistent etcd hostname? This would help if all control plane nodes are deleted at once\n- Default cluster service type to ClusterIP\n  - https://book.kubebuilder.io/cronjob-tutorial/webhook-implementation.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdippynark%2Fcluster-api-provider-kubernetes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdippynark%2Fcluster-api-provider-kubernetes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdippynark%2Fcluster-api-provider-kubernetes/lists"}