# Create a cluster

> Set up a Kubernetes cluster on CubeCOS with OpenStack cloud credentials and Rancher orchestration.

:::note

USB storage devices are blocked by default. If you need to access USB devices, set the tuning option `cubesys.probeusb` to `true` using **CLI** > **tuning** > **configure** after logging in as admin.

:::

## Prerequisites {#prerequisites}

:::note

User `bigstack-k8s` and project `bigstack-k8s` will be used during this demonstration.

:::

1. A project for Kubernetes has been created, and your Kubernetes permissions have been set to Administrator. See [Create a project](create-project.md).

2. An Amphora image has been imported.
   1. Download the Amphora image: [amphora-x64-haproxy_yoga](https://s3.bigstack.co/downloads/app-image/yoga/amphora-x64-haproxy_yoga.qcow2).
   2. Use `scp` to upload the downloaded image to the Glance image directory `/mnt/cephfs/glance`.
      1. From a computer with management access to your cluster VIP, run: `scp amphora-x64-haproxy_yoga.qcow2 root@<cluster-vip>:/mnt/cephfs/glance/`
   3. Log in to the admin shell.
   4. Run the following command to import the load balancer image:

```bash title="Admin shell"
cc1> iaas image import_lb
1: usb
2: local
Enter index: 2
1: amphora-x64-haproxy_yoga.qcow2
Enter index: 1
Importing...
[16:25:04] Converting image to RAW format ...
    (100.00/100%)
[16:25:11] Creating image amphora-x64-haproxy ...
[=============================>] 100%
aa93010b-eb36-4357-b1cf-fea46958908f
[16:26:07] Finished creating image amphora-x64-haproxy
Importing  complete. It is safe to remove the local image file.
```

3. A Linux image has been imported and is ready for use in deployments.

:::note

For this demonstration, you'll use the `ubuntu2404.qcow2` image as the base system image.

:::

1.  Visit the [CubeCOS Downloads page](../downloads/cloud_image.md) to obtain a supported image (for example, `ubuntu2404.qcow2`).
2.  Use `scp` to transfer the image to the Glance image store at `/mnt/cephfs/glance`.
    1. From a workstation or jump host with network access to your cluster VIP, run: `scp ubuntu2404.qcow2 root@<cluster-vip>:/mnt/cephfs/glance/`
3.  Log in to the admin shell.
4.  Run the following command to import the image:

```bash title="Admin shell"
cc1> iaas image import
1: usb
2: local
Enter index: 2
1: amphora-x64-haproxy_yoga.qcow2
2: ubuntu2404.qcow2
Enter index: 2
Specify image name: ubuntu_2404
Select domain:
1: default
Enter index: 1
Select tenant:
1: admin
2: bigstack-k8s
Enter index: 1
Bootable image or volume:
1: glance-images
2: cinder-volumes
Enter index: 1
Visibility:
1: public
2: private
Enter index: 1
Importing...
[16:29:57] Converting image to RAW format ...
    (100.00/100%)
[16:30:09] Creating image ubuntu_2404 ...
[=============================>] 100%
ebfa199b-12d2-4a7c-8a8e-aef452f71750
[16:31:39] Finished creating image ubuntu_2404
Importing ubuntu_2404 complete. It is safe to remove the local image file.
```

## Configure the OpenStack driver and cloud credential {#configure-the-openstack-driver-and-cloud-credential}

1. Log in to Rancher with the keycloak user `bigstack-k8s`.

   ![Rancher login screen for user bigstack-k8s](/assets/k8s/create_cluster_1.png)

2. Go to **Cluster Management**.

   ![Cluster Management page in Rancher](/assets/k8s/create_cluster_2.png)

3. Go to **Drivers**.

   ![Drivers page in Rancher](/assets/k8s/create_cluster_3.png)

4. Switch to the **Node Drivers** tab.

   ![Node Drivers tab highlighted](/assets/k8s/create_cluster_4.png)

5. Select **OpenStack** and choose **Active** from its action options.

   ![OpenStack driver selected with Active option](/assets/k8s/create_cluster_5.png)

6. Confirm the **State** column shows **Active**.

   ![OpenStack driver state set to Active](/assets/k8s/create_cluster_6.png)

7. Go to **Cloud Credentials**.

   ![Cloud Credentials page in Rancher](/assets/k8s/create_cluster_7.png)

8. In the top right corner, click **Create**.

   ![Create button on Cloud Credentials page](/assets/k8s/create_cluster_8.png)

9. Choose **OpenStack** as the cloud credential template.

   ![OpenStack template selected for cloud credentials](/assets/k8s/create_cluster_9.png)

10. Fill in the username as **Cloud Credential Name** and the user password as the **password** value, then click **Create**.

    ![Cloud credential form filled with username and password](/assets/k8s/create_cluster_10.png)

## Create the cluster {#create-the-cluster}

1. Return to the Rancher home page and click **Create**.

   ![Cluster creation button on Rancher home page](/assets/k8s/create_cluster_11.png)

2. Click **OpenStack**.

   ![OpenStack provider selected for cluster creation](/assets/k8s/create_cluster_12.png)

3. Fill in the following cluster information:
   - **Cluster Name**: Any name
   - **OpenStack Active Timeout**: `200`
   - **OpenStack Authentication URL**: `http://<CUBECOS-VIP>:5000/v3`
   - **OpenStack Endpoint Type**: `publicURL`
   - **OpenStack Flavor Name**: t2.medium or above (recommended)
   - **OpenStack Image Name**: `ubuntu_2404`
   - **Disable TLS Credential Checking**: Enabled
   - **OpenStack Version of IP Address**: `4`
   - **OpenStack Network ID**: `private-k8s` (from project bigstack-k8s)
   - **OpenStack Security Groups**: `default`, `default-k8s`
   - **OpenStack SSH Port**: `22`
   - **OpenStack SSH User**: `ubuntu`
   - **OpenStack Tenant ID**: ID for project bigstack-k8s
   - **OpenStack User ID**: ID for user bigstack-k8s

   ![Cluster configuration form with OpenStack settings](/assets/k8s/create_cluster_13.png)

4. Change the container network to **cilium**, then click **Create**.

   ![Container network set to cilium on cluster creation form](/assets/k8s/create_cluster_14.png)

5. Wait until the cluster state changes to **Active**.

   ![Cluster details page showing cluster status](/assets/k8s/create_cluster_15.png)
   ![Cluster Active state confirmation](/assets/k8s/create_cluster_16.png)
