# Kubernetes With Object Storage (EOS) Mount an [E2E Object Storage (EOS)](https://myaccount.e2enetworks.com) bucket into your workloads using [Datashim](https://github.com/datashim-io/datashim). Datashim's `Dataset` custom resource turns an S3-compatible bucket into a PersistentVolumeClaim that pods can mount like any other volume. ## Prerequisites - An active E2E Kubernetes cluster with `kubectl` configured. - An E2E Object Storage bucket, plus its **access key**, **secret key**, and **endpoint URL** (from the E2E Cloud Console under **Object Storage**). ## Step 1: Install Datashim Datashim runs in its own `dlf` namespace. Create the namespace first, then apply the Datashim manifest: ```bash kubectl create namespace dlf kubectl apply -f https://raw.githubusercontent.com/datashim-io/datashim/master/release-tools/manifests/dlf.yaml ``` :::warning Create the `dlf` namespace **before** applying the manifest. If it does not exist, the apply fails with `namespaces "dlf" not found`. ::: Wait for the Datashim pods to be ready, then enable the dataset admission webhook on the namespace where your workloads run (here, `default`): ```bash kubectl wait --for=condition=ready pods -l app.kubernetes.io/name=datashim -n dlf --timeout=180s kubectl label namespace default monitor-pods-datasets=enabled ``` ## Step 2: Create a Dataset A `Dataset` describes the bucket and credentials. Save the following as `dataset.yaml`, replacing the placeholders with your EOS values: ```yaml apiVersion: datashim.io/v1alpha1 kind: Dataset metadata: name: example-dataset spec: local: type: "COS" accessKeyID: "" secretAccessKey: "" endpoint: "" bucket: "" readonly: "true" # OPTIONAL, default is false region: "" # OPTIONAL, e.g. a region label such as "Delhi" ``` Apply it: ```bash kubectl apply -f dataset.yaml ``` Datashim creates a PVC and a ConfigMap that share the Dataset's name. Confirm they exist: ```bash kubectl get pvc,configmap ``` You should see a PVC and a ConfigMap named `example-dataset`. :::tip Use a Secret for credentials Embedding the access and secret keys directly in the `Dataset` is convenient for a quick test, but for anything beyond that, pass them through a Kubernetes Secret instead. See the [Datashim S3 provisioning example](https://github.com/datashim-io/datashim/blob/master/examples/templates/example-dataset-s3-provision.yaml). ::: ## Step 3: Mount the Dataset in a Pod Reference the Dataset from a pod using labels - Datashim's webhook injects the volume automatically. Save as `pod.yaml`: ```yaml apiVersion: v1 kind: Pod metadata: name: nginx labels: dataset.0.id: "example-dataset" dataset.0.useas: "mount" spec: containers: - name: nginx image: nginx ``` ```bash kubectl apply -f pod.yaml ``` By convention, the Dataset is mounted at `/mnt/datasets/example-dataset` inside the container. Verify: ```bash kubectl exec nginx -- ls /mnt/datasets/example-dataset ``` Refer to the [Datashim documentation](https://github.com/datashim-io/datashim) for advanced configuration. ---