# Setting up a PersistentVolume to run test

**URL:** <https://community.grafana.com/t/setting-up-a-persistentvolume-to-run-test/132377>\
**Category:** k6-operator\
**Created:** [September 18, 2024, 1:21am UTC](https://community.grafana.com/t/setting-up-a-persistentvolume-to-run-test/132377 "2024-09-18T01:21:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![thescoredevservices](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/thescoredevservices/32/48806_2.png) [@thescoredevservices](https://community.grafana.com/u/thescoredevservices)\
**Post date:** [September 18, 2024, 1:21am UTC](https://community.grafana.com/t/setting-up-a-persistentvolume-to-run-test/132377/1 "2024-09-18T01:21:09Z")

</div>

Hi,

I would like to Setting up a `PersistentVolume` to run test. I am geting the following error:

> level=error msg="The moduleSpecifier "/test/test.js" couldn’t be found on local disk. Make sure that you’ve specified the right path to the file. If you’re ru │  
> │ Stream closed EOF for k6-operator-system/run-k6-with-vars-initializer-vwccf (k6)

Below is my YAMLs. I am not sure what this means in the doc " When using a `PersistentVolume` , the operator will expect all test scripts to be contained within a directory named `/test/`" ? Can I please get some guidance here?

```auto
apiVersion: v1
kind: PersistentVolume
metadata:
  name: k6-volume
spec:
  capacity:
    storage: 1Gi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: /mnt/data/k6-test-scripts

```

```auto
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: k6-volume-claim
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi

```

```auto
apiVersion: k6.io/v1alpha1
kind: TestRun
metadata:
  name: run-k6-with-vars
spec:
  parallelism: 3
  script:
    volumeClaim:
      name: k6-volume-claim
      file: test.js
  runner:
    env:
      - name: USERS
        value: '5'
  # cleanup: "post"

```

---

<div class="post-metadata">

**Author:** ![olhayevtushenko](https://avatars.discourse-cdn.com/v4/letter/o/bb73d2/32.png) [@olhayevtushenko](https://community.grafana.com/u/olhayevtushenko)\
**Post date:** [September 19, 2024, 11:11am UTC](https://community.grafana.com/t/setting-up-a-persistentvolume-to-run-test/132377/3 "2024-09-19T11:11:34Z")

</div>

Hi @thescoredevservices, it looks like you’re using a local cluster: there may be differences in how local clusters can access a folder on your disk.

It makes sense to check what is actually available on that volume. I’d suggest to create an inspector pod with mounted volume manually, `kubectl exec` into it and double-check if k6 scripts are present where expected. If they are not, the next step is to figure out why your local cluster is not locating that folder with the scripts.

Hope that helps!

---

<div class="post-metadata">

**Author:** ![thescoredevservices](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/thescoredevservices/32/48806_2.png) [@thescoredevservices](https://community.grafana.com/u/thescoredevservices)\
**Post date:** [September 21, 2024, 4:26pm UTC](https://community.grafana.com/t/setting-up-a-persistentvolume-to-run-test/132377/4 "2024-09-21T16:26:58Z")

</div>

can you provide me example for Pv and pvc yamls please?

---

<div class="post-metadata">

**Author:** ![olhayevtushenko](https://avatars.discourse-cdn.com/v4/letter/o/bb73d2/32.png) [@olhayevtushenko](https://community.grafana.com/u/olhayevtushenko)\
**Post date:** [October 4, 2024, 10:54am UTC](https://community.grafana.com/t/setting-up-a-persistentvolume-to-run-test/132377/5 "2024-10-04T10:54:59Z")

</div>

@thescoredevservices, your yamls for PV and PVC look fine, AFAIS. But depending on specifics of your cluster setup, they might not be mounting your folder. For example, you’re using `hostPath`: it makes sense to double-check the [docs](https://kubernetes.io/docs/concepts/storage/volumes/#hostpath). Volumes need to be debugged, to confirm that the scripts can be accessed. I’d do that by `exec` to any long-running pod with volume attached.

---

<div class="post-metadata">

**Author:** ![vipulkhullar](https://avatars.discourse-cdn.com/v4/letter/v/58f4c7/32.png) [@vipulkhullar](https://community.grafana.com/u/vipulkhullar)\
**Post date:** [December 14, 2024, 4:34am UTC](https://community.grafana.com/t/setting-up-a-persistentvolume-to-run-test/132377/6 "2024-12-14T04:34:29Z")

</div>

were you able to run this i am facing the same issue
