Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions cluster-api/README.md
Original file line number Diff line number Diff line change
@@ -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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.
This project is a work in progress 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 <CLUSTER_NAME>
```

6. Delete all stale resources:

```bash
kubectl delete -f lsh-cluster.yaml
```
52 changes: 52 additions & 0 deletions cluster-api/latitude-cluster/README.md
Original file line number Diff line number Diff line change
@@ -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/<CLUSTER_NAME>/my-cluster/g' \
-e 's/<PROJECT_ID>/your-project-id/g' \
-e 's/<LOCATION>/SAO2/g' \
-e 's/<PLAN>/c2-small-x86/g' \
-e 's/<SSH_KEY_ID>/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 <CLUSTER_NAME>
```

4. Get the status of the cluster:

```bash
kubectl get latitudecluster <CLUSTER_NAME> -o jsonpath='{.status.ready}'
```

5. Delete the cluster:

```bash
kubectl delete latitudecluster <CLUSTER_NAME>
```

6. Delete all stale resources:

```bash
kubectl delete -f lsh-cluster.yaml
```
59 changes: 59 additions & 0 deletions cluster-api/latitude-cluster/lsh-cluster.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: LatitudeCluster
metadata:
name: "<CLUSTER_NAME>"
namespace: default
spec:
location: "<LOCATION>"
projectRef:
projectID: "<PROJECT_ID>"
---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: LatitudeMachineTemplate
metadata:
name: "<MACHINE_TEMPLATE_NAME>"
namespace: default
spec:
template:
spec:
projectID: "<PROJECT_ID>"
site: "<LOCATION>"
plan: "<PLAN>"
operatingSystem: "<OPERATING_SYSTEM>"
sshKeys:
- "<SSH_KEY_ID>"
---
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
kind: KubeadmControlPlane
metadata:
name: "<CONTROL_PLANE_NAME>"
namespace: default
spec:
replicas: 1
version: v1.30.0
machineTemplate:
infrastructureRef:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: LatitudeMachineTemplate
name: "<MACHINE_TEMPLATE_NAME>"
kubeadmConfigSpec:
clusterConfiguration:
controllerManager: {}
scheduler: {}
initConfiguration: {}
joinConfiguration: {}
---
apiVersion: cluster.x-k8s.io/v1beta1
kind: Cluster
metadata:
name: "<CLUSTER_NAME>"
namespace: default
spec:
infrastructureRef:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: LatitudeCluster
name: "<CLUSTER_NAME>"
controlPlaneRef:
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
kind: KubeadmControlPlane
name: "<CONTROL_PLANE_NAME>"
54 changes: 54 additions & 0 deletions cluster-api/latitude-machine/README.md
Original file line number Diff line number Diff line change
@@ -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/<MACHINE_NAME>/my-machine/g' \
-e 's/<PROJECT_ID>/your-project-id/g' \
-e 's/<LOCATION>/SAO2/g' \
-e 's/<PLAN>/c2-small-x86/g' \
-e 's/<SSH_KEY_ID>/your-ssh-key-id/g' \
-e 's/<KUBEADM_CONFIG_NAME>/my-kubeadm-config/g' \
-e 's/<CLUSTER_NAME>/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 <MACHINE_NAME>
```

4. Get the status of the machine:

```bash
kubectl get latitudemachine <MACHINE_NAME> -o jsonpath='{.status.ready}'
```

5. Delete the machine:

```bash
kubectl delete latitudemachine <MACHINE_NAME>
```

6. Delete all stale resources:

```bash
kubectl delete -f lsh-machine.yaml
```
39 changes: 39 additions & 0 deletions cluster-api/latitude-machine/lsh-machine.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
kind: LatitudeMachine
metadata:
name: "<MACHINE_NAME>"
namespace: default
spec:
projectID: "<PROJECT_ID>"
site: "<LOCATION>"
plan: "<PLAN>"
operatingSystem: "ubuntu_24_04_x64_lts"
sshKeys: ["<SSH_KEY_ID>"]
---
apiVersion: bootstrap.cluster.x-k8s.io/v1beta2
kind: KubeadmConfig
metadata:
name: "<KUBEADM_CONFIG_NAME>"
namespace: default
spec:
joinConfiguration:
nodeRegistration:
name: "{{ ds.meta_data.hostname }}"
---
apiVersion: cluster.x-k8s.io/v1beta2
kind: Machine
metadata:
name: "<MACHINE_NAME>"
namespace: default
spec:
clusterName: "<CLUSTER_NAME>"
version: v1.30.0
bootstrap:
configRef:
apiGroup: bootstrap.cluster.x-k8s.io
kind: KubeadmConfig
name: "<KUBEADM_CONFIG_NAME>"
infrastructureRef:
apiGroup: infrastructure.cluster.x-k8s.io
kind: LatitudeMachine
name: "<MACHINE_NAME>"