Skip to content

Commit

Permalink
docs: add provider section with examples
Browse files Browse the repository at this point in the history
  • Loading branch information
salasberryfin committed Jun 24, 2024
1 parent cf926ca commit 14df9fd
Show file tree
Hide file tree
Showing 4 changed files with 126 additions and 2 deletions.
57 changes: 57 additions & 0 deletions docs/reference-guides/providers/capa.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
sidebar_position: 0
---

# Create & import a cluster using CAPI provider for AWS

Remember that most Cluster API Providers are upstream projects maintained by the Kubernetes open-source community.

## Prerequisites

- Rancher Manager cluster with Rancher Turtles installed
- Cluster API providers installed for your scenario - we'll be using the AWS infrastructure in these instructions - you can find a guide on how to install a provider using the `CAPIProvider` resource [here](../../tasks/capi-operator/basic_cluster_api_provider_installation.md)
- **clusterctl** CLI - see the [releases](https://github.com/kubernetes-sigs/cluster-api/releases)

## Create Your Cluster Definition

To generate the YAML for the cluster, do the following (assuming the Docker infrastructure provider is being used):

1. Open a terminal and run the following:

```bash
export KUBERNETES_VERSION=v1.28
export AWS_REGION=eu-west-2
export AWS_INSTANCE_TYPE=t3.medium

clusterctl generate cluster cluster1 \
--from https://raw.githubusercontent.com/rancher-sandbox/rancher-turtles-fleet-example/templates/capa.yaml \
> cluster1.yaml
```
2. View **cluster1.yaml** to ensure there are no tokens. You can make any changes you want as well.

> The Cluster API quickstart guide contains more detail. Read the steps related to this section [here](https://cluster-api.sigs.k8s.io/user/quick-start.html#required-configuration-for-common-providers).
3. Create the cluster using kubectl

```bash
kubectl create -f cluster1.yaml
```

## Mark Namespace or Cluster for Auto-Import

To automatically import a CAPI cluster into Rancher Manager, there are 2 options:

1. Label a namespace so all clusters contained in it are imported.
2. Label an individual cluster definition so that it's imported.

Labeling a namespace:

```bash
kubectl label namespace default cluster-api.cattle.io/rancher-auto-import=true
```

Labeling an individual cluster definition:

```bash
kubectl label cluster.cluster.x-k8s.io cluster1 cluster-api.cattle.io/rancher-auto-import=true
```
58 changes: 58 additions & 0 deletions docs/reference-guides/providers/docker_kubeadm.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---
sidebar_position: 0
---

# Create & import a cluster using CAPI provider for Docker

This section will guide you through creating a cluster and importing it into Rancher Manager using kubectl.

## Prerequisites

- Rancher Manager cluster with Rancher Turtles installed
- Cluster API providers installed for your scenario - we'll be using the Docker infrastructure and Kubeadm bootstrap/control plane providers in these instructions - you can find a guide on how to install a provider using the `CAPIProvider` resource [here](../../tasks/capi-operator/basic_cluster_api_provider_installation.md)
- **clusterctl** CLI - see the [releases](https://github.com/kubernetes-sigs/cluster-api/releases)

## Create Your Cluster Definition

To generate the YAML for the cluster, do the following (assuming the Docker infrastructure provider is being used):

1. Open a terminal and run the following:

```bash
export CONTROL_PLANE_MACHINE_COUNT=1
export WORKER_MACHINE_COUNT=1
export KUBERNETES_VERSION=v1.26.4

clusterctl generate cluster cluster1 \
--from https://raw.githubusercontent.com/rancher-sandbox/rancher-turtles-fleet-example/templates/docker-kubeadm.yaml \
> cluster1.yaml
```

2. View **cluster1.yaml** to ensure there are no tokens. You can make any changes you want as well.

> The Cluster API quickstart guide contains more detail. Read the steps related to this section [here](https://cluster-api.sigs.k8s.io/user/quick-start.html#required-configuration-for-common-providers).
3. Create the cluster using kubectl

```bash
kubectl create -f cluster1.yaml
```

## Mark Namespace or Cluster for Auto-Import

To automatically import a CAPI cluster into Rancher Manager, there are 2 options:

1. Label a namespace so all clusters contained in it are imported.
2. Label an individual cluster definition so that it's imported.

Labeling a namespace:

```bash
kubectl label namespace default cluster-api.cattle.io/rancher-auto-import=true
```

Labeling an individual cluster definition:

```bash
kubectl label cluster.cluster.x-k8s.io cluster1 cluster-api.cattle.io/rancher-auto-import=true
```
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
sidebar_position: 0
---

# CAPI Providers
# Supported CAPI Providers

Remember that most Cluster API Providers are upstream projects maintained by the Kubernetes open-source community.

Expand Down
11 changes: 10 additions & 1 deletion sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,16 @@ const sidebars = {
]
},
'reference-guides/rancher-turtles-chart/values',
'reference-guides/providers',
{
type: 'category',
label: 'CAPI Providers',
collapsed: true,
items: [
'reference-guides/providers/supported',
'reference-guides/providers/docker_kubeadm',
'reference-guides/providers/capa',
]
},
],
},
{
Expand Down

0 comments on commit 14df9fd

Please sign in to comment.