Skip to content

Files

Latest commit

b18f4c8 · Mar 11, 2025

History

History
221 lines (168 loc) · 8.66 KB

get-started-with-clusterctl.md

File metadata and controls

221 lines (168 loc) · 8.66 KB

Prerequisites

Deploy Cluster Api

Clone

Please clone the project:

git clone https://github.com/outscale-dev/cluster-api-provider-outscale

If you use your own management cluster:

 export KUBECONFIG=<...>

Or you can use kind (only for local dev): Create kind:

   kind create cluster

Check cluster is ready:

   kubectl cluster-info

Install clusterctl

Install clusterctl using the Makefile:

make install-clusterctl

In order to install tools (clusterctl, ...) with the Makefile, you need to have golang installed.

Or using Cluster Api Quickstart.

And check version which is already installed:

./bin/clusterctl version

clusterctl version: &version.Info{Major:"1", Minor:"8", GitVersion:"v1.8.1", GitCommit:"02769254e95db17afbd6ec4036aacbd294d9424c", GitTreeState:"clean", BuildDate:"2024-08-14T05:53:36Z", GoVersion:"go1.22.5", Compiler:"gc", Platform:"linux/amd64"}

Setup clusterctl

You can enable ClusterResourceSet with

export EXP_CLUSTER_RESOURCE_SET=true

You can enable ClusterClass with

export CLUSTER_TOPOLOGY=true

Please create $HOME/.cluster-api/clusterctl.yaml:

providers:
- name: outscale
  type: InfrastructureProvider
  url: https://github.com/outscale/cluster-api-provider-outscale/releases/latest/infrastructure-components.yaml

Install credentials for your workload cluster Outscale account:

export OSC_ACCESS_KEY=<your-access-key>
export OSC_SECRET_KEY=<your-secret-access-key>
export OSC_REGION=<your-region>

make credential

Install Cluster Api controllers:

./bin/clusterctl init --infrastructure outscale

Create a workload cluster

Generate cluster configuration

Create a keypair.

export OSC_IOPS=<osc-iops>
export OSC_VOLUME_SIZE=<osc-volume-size>
export OSC_VOLUME_TYPE=<osc-volume-type>
export OSC_KEYPAIR_NAME=<osc-keypairname>
export OSC_SUBREGION_NAME=<osc-subregion>
export OSC_VM_TYPE=<osc-vm-type>
export OSC_IMAGE_NAME=<osc-image-name>

./bin/clusterctl generate cluster <cluster-name>   --kubernetes-version <kubernetes-version>   --control-plane-machine-count=<control-plane-machine-count>   --worker-machine-count=<worker-machine-count> > getstarted.yaml

WARNING: Kubernetes version must match the kubernetes version which is included in image name in omi

You can adapt the generated yaml file to your needs.

Then apply:

kubectl apply -f getstarted.yaml

CNI & CCM

In order for nodes to be ready, you must have a CNI and CCM.

You can use ClusterResourceSet with label clustername + crs-cni and label clustername + crs-ccm where clustername is the name of your cluster.

To install CNI you can use a helm chart or a ClusterResourceSet.

To install CCM, you can use a helm chart or a ClusterResourceSet.

Cluster Api status

You can then get the status:

root@cidev-admin v1beta1]# kubectl get cluster-api  -A
NAMESPACE   NAME                                                                       CLUSTER       AGE
default     kubeadmconfig.bootstrap.cluster.x-k8s.io/cluster-api-control-plane-lzj65   cluster-api   95m
default     kubeadmconfig.bootstrap.cluster.x-k8s.io/cluster-api-md-0-zgx4w            cluster-api   95m

NAMESPACE   NAME                                                                AGE
default     kubeadmconfigtemplate.bootstrap.cluster.x-k8s.io/cluster-api-md-0   95m

NAMESPACE   NAME                                                      CLUSTER       REPLICAS   READY   AVAILABLE   AGE   VERSION
default     machineset.cluster.x-k8s.io/cluster-api-md-0-7568fb659d   cluster-api   1                              95m   v1.22.11

NAMESPACE   NAME                                                  CLUSTER       REPLICAS   READY   UPDATED   UNAVAILABLE   PHASE       AGE   VERSION
default     machinedeployment.cluster.x-k8s.io/cluster-api-md-0   cluster-api   1                  1         1             ScalingUp   95m   v1.22.11

NAMESPACE   NAME                                                         CLUSTER       NODENAME                                  PROVIDERID         PHASE      AGE   VERSION
default     machine.cluster.x-k8s.io/cluster-api-control-plane-4q2s8     cluster-api   ip-10-0-0-45.eu-west-2.compute.internal   aws:///eu-west-2a/i-3b629324    Running    95m   v1.22.11
default     machine.cluster.x-k8s.io/cluster-api-md-0-7568fb659d-hnkfw   cluster-api   ip-10-0-0-144.eu-west-2.compute.internal   aws:///eu-west-2a/i-add154be   Running    95m   v1.22.11

NAMESPACE   NAME                                   PHASE         AGE   VERSION
default     cluster.cluster.x-k8s.io/cluster-api   Provisioned   95m   

NAMESPACE                           NAME                                                         AGE   TYPE                   PROVIDER      VERSION
capi-kubeadm-bootstrap-system       provider.clusterctl.cluster.x-k8s.io/bootstrap-kubeadm       46h   BootstrapProvider      kubeadm       v1.2.1
capi-kubeadm-control-plane-system   provider.clusterctl.cluster.x-k8s.io/control-plane-kubeadm   46h   ControlPlaneProvider   kubeadm       v1.2.1
capi-system                         provider.clusterctl.cluster.x-k8s.io/cluster-api             46h   CoreProvider           cluster-api   v1.2.1

NAMESPACE   NAME                                                                          CLUSTER       INITIALIZED   API SERVER AVAILABLE   REPLICAS   READY   UPDATED   UNAVAILABLE   AGE   VERSION
default     kubeadmcontrolplane.controlplane.cluster.x-k8s.io/cluster-api-control-plane   cluster-api                                        1                  1         1             95m   v1.22.11

NAMESPACE   NAME                                                                           AGE
default     oscmachinetemplate.infrastructure.cluster.x-k8s.io/cluster-api-control-plane   95m
default     oscmachinetemplate.infrastructure.cluster.x-k8s.io/cluster-api-md-0            95m

Connect to a workload cluster

You can get a kubeconfig to connect to your workload cluster with clusterctl get kubeconfig.

Add a security group rule to an existing workload cluster

You can add security group rule if you set extraSecurityGroupRule = true after you have already create a cluster and you want to set new security group rule.

apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: OscCluster
metadata:
  name: cluster-api
  namespace: default
spec:
  network:
    extraSecurityGroupRule: false

Delete Cluster api

Delete cluster

To delete our cluster:

kubectl delete -f getstarted.yaml

To delete cluster-api:

clusterctl delete --all