|
| 1 | +# Getting started |
| 2 | + |
| 3 | +This document will help you provision a management cluster and a workload cluster. |
| 4 | + |
| 5 | +## Setup a management cluster |
| 6 | + |
| 7 | +### Provision the cluster |
| 8 | + |
| 9 | +You can use any existing Kubernetes cluster as a management cluster. If you don't |
| 10 | +have one, you can use one of the following methods to provision a cluster. At the |
| 11 | +end of this section, you must have the kubeconfig of your future management cluster. |
| 12 | + |
| 13 | +#### Method 1: Create a Scaleway Kapsule cluster |
| 14 | + |
| 15 | +Follow this documentation to create a Scaleway Kapsule cluster: [Kubernetes - Quickstart](https://www.scaleway.com/en/docs/containers/kubernetes/quickstart/) |
| 16 | + |
| 17 | +Make sure the `KUBECONFIG` environment variable points to the cluster's kubeconfig: |
| 18 | + |
| 19 | +```console |
| 20 | +export KUBECONFIG=/path/to/your/kubeconfig |
| 21 | +``` |
| 22 | + |
| 23 | +#### Method 2: Create a cluster in Docker with kind |
| 24 | + |
| 25 | +1. Follow this documentation to install Docker: [Install Docker Engine](https://docs.docker.com/engine/install/) |
| 26 | +2. Follow this documentation to install kind: [Quick Start](https://kind.sigs.k8s.io/docs/user/quick-start/) |
| 27 | +3. Create a kind cluster: |
| 28 | + |
| 29 | + ```console |
| 30 | + $ kind create cluster |
| 31 | + Creating cluster "kind" ... |
| 32 | + ✓ Ensuring node image (kindest/node:v1.27.3) 🖼 |
| 33 | + ✓ Preparing nodes 📦 |
| 34 | + ✓ Writing configuration 📜 |
| 35 | + ✓ Starting control-plane 🕹️ |
| 36 | + ✓ Installing CNI 🔌 |
| 37 | + ✓ Installing StorageClass 💾 |
| 38 | + Set kubectl context to "kind-kind" |
| 39 | + You can now use your cluster with: |
| 40 | + |
| 41 | + kubectl cluster-info --context kind-kind |
| 42 | + |
| 43 | + Have a question, bug, or feature request? Let us know! https://kind.sigs.k8s.io/#community 🙂 |
| 44 | + ``` |
| 45 | + |
| 46 | +4. Get the kubeconfig: |
| 47 | + |
| 48 | + ```console |
| 49 | + kind get kubeconfig > mgmt.yaml |
| 50 | + export KUBECONFIG=mgmt.yaml |
| 51 | + ``` |
| 52 | + |
| 53 | +### Install cluster API and the Scaleway provider |
| 54 | + |
| 55 | +1. Follow these instructions to install the `clusterctl` command-line tool: [Install clusterctl](https://cluster-api.sigs.k8s.io/user/quick-start#install-clusterctl) |
| 56 | +2. Add `scaleway` to the provider repositories by following this [documentation](https://cluster-api.sigs.k8s.io/clusterctl/configuration#provider-repositories). |
| 57 | + You should have the following config: |
| 58 | + |
| 59 | + ```bash |
| 60 | + $ cat $HOME/.config/cluster-api/clusterctl.yaml |
| 61 | + providers: |
| 62 | + - name: "scaleway" |
| 63 | + url: "https://github.com/Tomy2e/cluster-api-provider-scaleway/releases/latest/infrastructure-components.yaml" |
| 64 | + type: "InfrastructureProvider" |
| 65 | + ``` |
| 66 | + |
| 67 | +3. Initialize the management cluster: |
| 68 | + |
| 69 | + ```console |
| 70 | + $ clusterctl init --infrastructure scaleway |
| 71 | + Fetching providers |
| 72 | + Installing cert-manager Version="v1.14.4" |
| 73 | + Waiting for cert-manager to be available... |
| 74 | + Installing Provider="cluster-api" Version="v1.7.0" TargetNamespace="capi-system" |
| 75 | + Installing Provider="bootstrap-kubeadm" Version="v1.7.0" TargetNamespace="capi-kubeadm-bootstrap-system" |
| 76 | + Installing Provider="control-plane-kubeadm" Version="v1.7.0" TargetNamespace="capi-kubeadm-control-plane-system" |
| 77 | + Installing Provider="infrastructure-scaleway" Version="v0.0.1" TargetNamespace="cluster-api-provider-scaleway-system" |
| 78 | + |
| 79 | + Your management cluster has been initialized successfully! |
| 80 | + |
| 81 | + You can now create your first workload cluster by running the following: |
| 82 | + |
| 83 | + clusterctl generate cluster [name] --kubernetes-version [version] | kubectl apply -f - |
| 84 | + ``` |
| 85 | + |
| 86 | +### Create a basic worklow cluster |
| 87 | + |
| 88 | +1. Replace the placeholder values and set the following environment variables: |
| 89 | + |
| 90 | + ```bash |
| 91 | + export CLUSTER_NAME="my-cluster" |
| 92 | + export KUBERNETES_VERSION="1.30.0" |
| 93 | + export SCW_REGION="fr-par" |
| 94 | + export SCW_ACCESS_KEY="CHANGE THIS" |
| 95 | + export SCW_SECRET_KEY="CHANGE THIS" |
| 96 | + export SCW_PROJECT_ID="CHANGE THIS" |
| 97 | + ``` |
| 98 | + |
| 99 | +2. Generate the cluster manifests: |
| 100 | + |
| 101 | + ```bash |
| 102 | + clusterctl generate cluster ${CLUSTER_NAME} > my-cluster.yaml |
| 103 | + ``` |
| 104 | + |
| 105 | +3. Review and edit the `my-cluster.yaml` file as needed. |
| 106 | +4. Apply the `my-cluster.yaml` file to create the workflow cluster. |
| 107 | +5. Wait for the cluster to be ready. |
| 108 | + |
| 109 | + ```bash |
| 110 | + $ watch clusterctl describe cluster ${CLUSTER_NAME} |
| 111 | + NAME READY SEVERITY REASON SINCE MESSAGE |
| 112 | + Cluster/my-cluster True 4m14s |
| 113 | + ├─ClusterInfrastructure - ScalewayCluster/my-cluster |
| 114 | + ├─ControlPlane - KubeadmControlPlane/my-cluster-control-plane True 4m14s |
| 115 | + │ └─Machine/my-cluster-control-plane-4rrb7 True 6m4s |
| 116 | + │ └─MachineInfrastructure - ScalewayMachine/my-cluster-control-plane-4rrb7 |
| 117 | + └─Workers |
| 118 | + └─MachineDeployment/my-cluster-md-0 True 73s |
| 119 | + └─Machine/my-cluster-md-0-22sk4-6jwk2 True 3m51s |
| 120 | + └─MachineInfrastructure - ScalewayMachine/my-cluster-md-0-22sk4-6jwk2 |
| 121 | + ``` |
| 122 | + |
| 123 | +6. Fetch the kubeconfig of the cluster. |
| 124 | + |
| 125 | + ```bash |
| 126 | + clusterctl get kubeconfig ${CLUSTER_NAME} > kubeconfig.yaml |
| 127 | + export KUBECONFIG=kubeconfig.yaml |
| 128 | + ``` |
| 129 | + |
| 130 | +7. List nodes. |
| 131 | + |
| 132 | + ```bash |
| 133 | + $ kubectl get nodes |
| 134 | + NAME STATUS ROLES AGE VERSION |
| 135 | + caps-my-cluster-control-plane-4rrb7 Ready control-plane 6m18s v1.30.0 |
| 136 | + caps-my-cluster-md-0-22sk4-6jwk2 Ready <none> 3m18s v1.30.0 |
| 137 | + ``` |
| 138 | + |
| 139 | +### Setup the workflow cluster |
| 140 | + |
| 141 | +The workload cluster is ready to use. You should now: |
| 142 | + |
| 143 | +- Install a CNI plugin |
| 144 | +- (Optional) Install the Scaleway CSI driver to manage block volumes and snapshots. |
| 145 | +- (Optional) Install the Scaleway CCM to manage LoadBalancers |
0 commit comments