diff --git a/cluster-api/README.md b/cluster-api/README.md new file mode 100644 index 0000000..adfd12d --- /dev/null +++ b/cluster-api/README.md @@ -0,0 +1,50 @@ +# Cluster API - Latitude.sh + +## Disclaimer + +This project is a work in progress and is not yet ready for production use. The project is currently in alpha and is not recommended for production use. + +## Prerequisites + +- [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/) installed +- [docker](https://docs.docker.com/get-docker/) installed +- [kind](https://kind.sigs.k8s.io/docs/user/quick-start/#installation) installed +- [Cluster API provider for Latitude.sh](https://github.com/latitudesh/cluster-api-provider-latitudesh) installed + +## Getting Started + +1. Install the Cluster API provider for Latitude.sh: + +```bash +make install +``` + +2. Deploy the Cluster API provider for Latitude.sh: + +```bash +make deploy +``` + +3. Apply the `lsh-cluster.yaml` file: + +```bash +kubectl apply -f lsh-cluster.yaml +``` + +4. Wait for the cluster to be ready: + +```bash +kubectl get latitudecluster +``` + +5. Delete the cluster: + +```bash +kubectl delete latitudecluster +``` + +6. Delete all stale resources: + +```bash +kubectl delete -f lsh-cluster.yaml +``` \ No newline at end of file diff --git a/cluster-api/latitude-cluster/README.md b/cluster-api/latitude-cluster/README.md new file mode 100644 index 0000000..3ff19e2 --- /dev/null +++ b/cluster-api/latitude-cluster/README.md @@ -0,0 +1,52 @@ +# Latitude Cluster + +This example shows how to create a Kubernetes cluster on Latitude using the Cluster API provider for Latitude.sh. + +## Getting Started + +0. Change the `CLUSTER_NAME`, `PROJECT_ID`, `LOCATION`, `PLAN`, `OPERATING_SYSTEM`, and `SSH_KEY_ID` in the `lsh-cluster.yaml` file. +```bash +sed -i \ + -e 's//my-cluster/g' \ + -e 's//your-project-id/g' \ + -e 's//SAO2/g' \ + -e 's//c2-small-x86/g' \ + -e 's//your-ssh-key-id/g' \ + lsh-cluster.yaml +``` + +1. Apply the `lsh-cluster.yaml` file: + +```bash +kubectl apply -f lsh-cluster.yaml +``` + +2. Wait for the cluster to be ready: + +```bash +kubectl get latitudecluster +``` + +3. Get the description of the cluster: + +```bash +kubectl describe latitudecluster +``` + +4. Get the status of the cluster: + +```bash +kubectl get latitudecluster -o jsonpath='{.status.ready}' +``` + +5. Delete the cluster: + +```bash +kubectl delete latitudecluster +``` + +6. Delete all stale resources: + +```bash +kubectl delete -f lsh-cluster.yaml +``` \ No newline at end of file diff --git a/cluster-api/latitude-cluster/lsh-cluster.yaml b/cluster-api/latitude-cluster/lsh-cluster.yaml new file mode 100644 index 0000000..aab32c2 --- /dev/null +++ b/cluster-api/latitude-cluster/lsh-cluster.yaml @@ -0,0 +1,59 @@ +apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +kind: LatitudeCluster +metadata: + name: "" + namespace: default +spec: + location: "" + projectRef: + projectID: "" +--- +apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +kind: LatitudeMachineTemplate +metadata: + name: "" + namespace: default +spec: + template: + spec: + projectID: "" + site: "" + plan: "" + operatingSystem: "" + sshKeys: + - "" +--- +apiVersion: controlplane.cluster.x-k8s.io/v1beta1 +kind: KubeadmControlPlane +metadata: + name: "" + namespace: default +spec: + replicas: 1 + version: v1.30.0 + machineTemplate: + infrastructureRef: + apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 + kind: LatitudeMachineTemplate + name: "" + kubeadmConfigSpec: + clusterConfiguration: + controllerManager: {} + scheduler: {} + initConfiguration: {} + joinConfiguration: {} +--- +apiVersion: cluster.x-k8s.io/v1beta1 +kind: Cluster +metadata: + name: "" + namespace: default +spec: + infrastructureRef: + apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 + kind: LatitudeCluster + name: "" + controlPlaneRef: + apiVersion: controlplane.cluster.x-k8s.io/v1beta1 + kind: KubeadmControlPlane + name: "" diff --git a/cluster-api/latitude-machine/README.md b/cluster-api/latitude-machine/README.md new file mode 100644 index 0000000..e74d53e --- /dev/null +++ b/cluster-api/latitude-machine/README.md @@ -0,0 +1,54 @@ +# Latitude Machine + +This example shows how to create a machine on Latitude using the Cluster API provider for Latitude.sh. + +## Getting Started + +0. Change the `PROJECT_ID`, `LOCATION`, `PLAN`, `OPERATING_SYSTEM`, and `SSH_KEY_ID` in the `lsh-machine.yaml` file. +```bash +sed -i \ + -e 's//my-machine/g' \ + -e 's//your-project-id/g' \ + -e 's//SAO2/g' \ + -e 's//c2-small-x86/g' \ + -e 's//your-ssh-key-id/g' \ + -e 's//my-kubeadm-config/g' \ + -e 's//my-cluster/g' \ + lsh-machine.yaml +``` + +1. Apply the `lsh-machine.yaml` file: + +```bash +kubectl apply -f lsh-machine.yaml +``` + +2. Wait for the machine to be ready: + +```bash +kubectl get latitudemachine +``` + +3. Get the description of the machine: + +```bash +kubectl describe latitudemachine +``` + +4. Get the status of the machine: + +```bash +kubectl get latitudemachine -o jsonpath='{.status.ready}' +``` + +5. Delete the machine: + +```bash +kubectl delete latitudemachine +``` + +6. Delete all stale resources: + +```bash +kubectl delete -f lsh-machine.yaml +``` \ No newline at end of file diff --git a/cluster-api/latitude-machine/lsh-machine.yaml b/cluster-api/latitude-machine/lsh-machine.yaml new file mode 100644 index 0000000..d81940a --- /dev/null +++ b/cluster-api/latitude-machine/lsh-machine.yaml @@ -0,0 +1,39 @@ +apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 +kind: LatitudeMachine +metadata: + name: "" + namespace: default +spec: + projectID: "" + site: "" + plan: "" + operatingSystem: "ubuntu_24_04_x64_lts" + sshKeys: [""] +--- +apiVersion: bootstrap.cluster.x-k8s.io/v1beta2 +kind: KubeadmConfig +metadata: + name: "" + namespace: default +spec: + joinConfiguration: + nodeRegistration: + name: "{{ ds.meta_data.hostname }}" +--- +apiVersion: cluster.x-k8s.io/v1beta2 +kind: Machine +metadata: + name: "" + namespace: default +spec: + clusterName: "" + version: v1.30.0 + bootstrap: + configRef: + apiGroup: bootstrap.cluster.x-k8s.io + kind: KubeadmConfig + name: "" + infrastructureRef: + apiGroup: infrastructure.cluster.x-k8s.io + kind: LatitudeMachine + name: ""