Jenkins Pipeline Kubernetes Agent shared Volumes
To solve this, you need to include the volume mounts in the containers described here:

Sample Jenkinsfile:

pipeline {
    agent {
    kubernetes {
      label 'test-pod'
      defaultContainer 'jnlp'
      yaml """
apiVersion: v1
kind: Pod
spec:
  containers:
  - name: frontend-test
    image: centos:7
    command:
    - cat
    tty: true
    volumeMounts:
    - mountPath: '/opt/app/shared'
      name: sharedvolume
  - name: backend-test
    image: centos:7
    command:
    - cat
    tty: true   
    volumeMounts:
    - mountPath: '/opt/app/shared'
      name: sharedvolume
  volumes:
  - name: sharedvolume
    emptyDir: {}
"""
        }
    }
    stages {
        stage('Test Pipeline Configuration') {
            steps {
                container('frontend-test') {
                    sh 'touch /opt/app/shared/test_file'
                }
                container('backend-test') {
                    sh 'ls /opt/app/shared/test_file ; echo $?'
                }
            }
        }
    }
}


Result:

This solved the problem.

[Pipeline] podTemplate
[Pipeline] {
[Pipeline] node
Still waiting to schedule task
All nodes of label ‘test-pod’ are offline
Agent test-pod-wv12q-brfxj is provisioned from template Kubernetes Pod Template
Agent specification [Kubernetes Pod Template] (test-pod): 

Running on test-pod-wv12q-brfxj in /home/jenkins/workspace/pipeline-test
[Pipeline] {
[Pipeline] container
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Test Pipeline Configuration)
[Pipeline] container
[Pipeline] {
[Pipeline] sh
[pipeline-test] Running shell script
+ touch /opt/app/shared/test_file
[Pipeline] }
[Pipeline] // container
[Pipeline] container
[Pipeline] {
[Pipeline] sh
[pipeline-test] Running shell script
+ ls /opt/app/shared/test_file
/opt/app/shared/test_file
+ echo 0
0
[Pipeline] }
[Pipeline] // container
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // container
[Pipeline] }
[Pipeline] // node
[Pipeline] }
[Pipeline] // podTemplate
[Pipeline] End of Pipeline
Finished: SUCCESS