Building images

Cluster pre-requisites for building images

To connect a Builder Cluster to Bunnyshell, you need to create a StorageClass in Kubernetes with the name bns-builder-sc.

Bunnyshell needs it to make sure of the following:

  • The reclaimPolicy property is set to delete;
  • Auto-provisioning of volumes is enabled - Private Volume (PV) from Private Volume Claim (PVC).

📘

By default, the build commands are executed in the current working directory. Bunnyshell considers the working directory to be the one where the docker-compose file is located.

 

Variant 1 (Add-on)

Bunnyshell can help you create this StorageClass in the Bunnyshell Volumes Add-on

and enabling Build StorageClass

You can specify a provisioner or, if left empty, Bunnyshell will detect the provisioner used by the default StorageClass in your cluster an use that for the bns-builder-sc StorageClass too.

Then "Enable Add-on" and Bunnyshell will start creating the StorageClass.

This variant should work for any cluster, but if you need more configuration on the StorageClass, see below the manual variant. Don't forget to disable Build StorageClass from Add-on, so Bunnyshell won't update your manually configured class.

 

Variant 2 (Manual setup)

If you need more configuration on the bns-builder-sc StorageClass, than the Bunnyshell Volumes Add-on presented above can handle, you can create this class manually. Make sure Build StorageClass option from Add-on is disabled, so Bunnyshell won't update your manually configured class, then you can proceed with the steps below.

Creating a Storage Class

To create a class you can use kubectl and follow the instructions below:

  1. Create a spec.yaml file with the following contents
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: bns-builder-sc
provisioner: <varies according to provider>
reclaimPolicy: Delete
volumeBindingMode: Immediate
  1. Make sure kubectl has access to the cluster in question..

  2. Run kubectl apply -f spec.yaml

🚧

Important

To make sure the operation was successful, run:
kubectl describe storageclass bns-builder-sc

 

Specific Cloud Provider Recipes

As an alternative, you can follow these instructions to create the storage class:

Amazon Web Services

Define the StorageClass using the content below:

kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: bns-builder-sc
provisioner: kubernetes.io/aws-ebs
reclaimPolicy: Delete
volumeBindingMode: Immediate

📘

Make sure that your cluster has the Amazon EBS CSI add-on.

📘

Note

Read more about StorageClasses on the AWS documentation website.

 

Microsoft Azure

Define the StorageClass using the content below:

kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: bns-builder-sc
provisioner: disk.csi.azure.com
reclaimPolicy: Delete
volumeBindingMode: Immediate

📘

Note

Additional information regarding StorageClasses is available on the Azure docs website.

 

Google Cloud Platform

Define the StorageClass using the content below:

kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: bns-builder-sc
provisioner: kubernetes.io/gce-pd
reclaimPolicy: Delete
volumeBindingMode: Immediate

📘

Note

You can find out more about Storage Classes on the Google Cloud documentation website.

 

DigitalOcean

To add a Storage Class in DigitalOcean, follow the steps detailed below:

  1. Log in to your DigitalOcean account and select a cluster.
  2. Click Kubernetes Dashboard.
  3. On the left side menu, scroll to the Config and Storage category and click Storage Classes.
  4. Click the Create new resource button in the upper-right corner of the main interface.
  5. Input the content below, then click Upload.
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: bns-builder-sc
provisioner: dobs.csi.digitalocean.com
reclaimPolicy: Delete
volumeBindingMode: Immediate

 

DT Cloud

Define the StorageClass using the content below:

kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: bns-builder-sc
provisioner: cinder.csi.openstack.org
parameters:
  type: "General SSD"
reclaimPolicy: Delete
volumeBindingMode: Immediate

 

Other / Private Kubernetes Clusters

For other Kubernetes clusters, the provisioner will vary, so you will have to fill it in yourself.

kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: bns-builder-sc
provisioner: <varies according to provider>
reclaimPolicy: Delete
volumeBindingMode: Immediate

📘

Note

You can find additional information regarding Storage Classes on the official Kubernetes documentation platform.