How to Use Spaces With Kubernetes Clusters

DigitalOcean Kubernetes (DOKS) is a managed Kubernetes service that lets you deploy Kubernetes clusters without the complexities of handling the control plane and containerized infrastructure. Clusters are compatible with standard Kubernetes toolchains, integrate natively with DigitalOcean Load Balancers and volumes, and can be managed programmatically using the API and command line. For critical workloads, add the high-availability control plane to increase uptime with 99.95% SLA.

DigitalOcean Spaces Object Storage allows you to store large amounts of static, unstructured data, such as text, audio, video, and images, for your Kubernetes cluster. To programmatically integrate a Spaces bucket with your Kubernetes environment, you can use one of AWS’ S3 Software Development Kits (SDKs). This enables your DOKS pods to share access to the bucket(s) at all times and freely store and retrieve files. Spaces buckets can perform up to 800 total operations per second per bucket, and to scale further, you can add more buckets to meet your application’s needs.

To use Spaces with your DOKS cluster:

  1. Create a DigitalOcean Spaces bucket.

  2. Set up s3cmd 2.x with DigitalOcean Spaces.

  3. Enable persistent storage for your application to use the DigitalOcean Spaces bucket.

    The persistent storage configuration is application specific. Refer to the provider’s documentation for specific details. For example, if you are using Grafana Loki for aggregating application logs, you need to add the following to the Helm chart YAML file to configure DigitalOcean Spaces persistent storage:

        bucketnames: <YOUR_DO_SPACES_BUCKET_NAME>
        access_key_id: <YOUR_DO_SPACES_ACCESS_KEY>
        secret_access_key: <YOUR_DO_SPACES_SECRET_KEY>
  4. Install your application.

    Once installed, you should see a DigitalOcean Spaces bucket created in the control panel that your DOKS cluster can access for storage. You can manage its stored data from within the control panel.

    The index page of an empty bucket