<p>I have created kubernetes cluster on digitalocean. and I have deployed k6 as a job on kubernetes cluster.</p>
<pre><code>apiVersion: batch/v1
kind: Job
metadata:
  name: benchmark
spec:
  template:
    spec:
      containers:
      - name: benchmark
        image: loadimpact/k6:0.29.0
        command: [&quot;k6&quot;, &quot;run&quot;, &quot;--vus&quot;, &quot;2&quot;, &quot;--duration&quot;, &quot;5m&quot;, &quot;--out&quot;, &quot;json=./test.json&quot;, &quot;/etc/k6-config/script.js&quot;]
        volumeMounts:
        - name: config-volume
          mountPath: /etc/k6-config
      restartPolicy: Never
      volumes:
      - name: config-volume
        configMap:
          name: k6-config
</code></pre>
<p>this is how my k6-job.yaml file look like. After deploying it in kubernetes cluster I have checked the pods logs. it is showing permission denied error.
level=error msg=&quot;open ./test.json: permission denied&quot;
how to solve this issue?</p>

Devi varalakshmi Tangilla
<p>The k6 Docker image runs as an unprivileged user, but unfortunately the default work directory is set to <code>/</code>, so it has no permission to write there.</p>
<p>To work around this consider changing the JSON output path to <code>/home/k6/out.json</code>, i.e.:</p>
<pre><code>command: [&quot;k6&quot;, &quot;run&quot;, &quot;--vus&quot;, &quot;2&quot;, &quot;--duration&quot;, &quot;5m&quot;, &quot;--out&quot;, &quot;json=/home/k6/test.json&quot;, &quot;/etc/k6-config/script.js&quot;]
</code></pre>
<p>I'm one of the maintainers on the team, so will propose a change to the Dockerfile to set the <code>WORKDIR</code> to <code>/home/k6</code> to make the default behavior a bit more intuitive.</p>
