<p>I'm using jenkins to start my builds in a kubernetes cluster via the kubernetes plugin.
When trying to set my jenkins <code>workspace-volume</code> to <code>medium: Memory</code> so that it runs in RAM, I receive the following error:</p>

<pre><code>spec.volumes[1].name: Duplicate value: "workspace-volume"
</code></pre>

<p>This is the corresponding yaml:</p>

<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: jenkins-job-xyz
  labels:
    identifier: jenkins-job-xyz
spec:
  restartPolicy: Never
  containers:
  - name: jnlp
    image: 'jenkins/jnlp-slave:alpine'
    volumeMounts:
    - name: workspace-volume
      mountPath: /home/jenkins
  - name: maven
    image: maven:latest
    imagePullPolicy: Always
    volumeMounts:
    - name: workspace-volume
      mountPath: /home/jenkins
  volumes:
    - name: workspace-volume
      emptyDir:
        medium: Memory
</code></pre>

<p>The only thing I added is the <code>volumes:</code> part at the end.</p>

Marty
<p>The volume <code>workspace-volume</code> is auto-generated by the kubernetes plugin and so a manual declaration will result in a duplicate entry.</p>

<p>For running the <code>workspace-volume</code> in RAM, set</p>

<pre><code>workspaceVolume: emptyDirWorkspaceVolume(memory: true)
</code></pre>

<p>inside the <code>podTemplate</code> closure according to the <a href="https://jenkins.io/doc/pipeline/steps/kubernetes/" rel="nofollow noreferrer">documentation</a>.</p>
