How to mount a volume in a Kubernetes test (acorn)
# 🌱|help-and-getting-started
b
I have to mount some secrets as files for a service pod or test pod to function. The only path to do this is by using a garden module type: Kubernetes. the Deployment works, mounts the secrets using volumeMounts from secret, and the service runs successfully.
Copy code
garden.yml
  |-> files:
          |-> build.yml
          |-> deployment.yml
              |-> volume: my-secrets
  |-> tests:
          |-> resource:
                kind: Deployment
                name: my-svc
                containerName: main
The test pod comes up, and the spec has the volume
my-secrets
though i don't see any way to mount
my-secrets
into the test pod.
b
Hi @bland-wolf-59979 according to the Acorn docs, [test Pods should use the
volumes
declared in the manifest](https://docs.garden.io/acorn-0.12/reference/module-types/kubernetes#tests-.resource). If it doesn't work, that's a bug – but [Acorn is EOL](https://github.com/garden-io/garden/issues/6119) and we're unfortunately not going to fix this bug anymore. It's worth it updating to Bonsai though, I think this has been fixed there. In bonsai there are two different action kinds to accomplish this: -
kubernetes-exec
Tests allow you to run a command in an already deployed container (https://docs.garden.io/reference/action-types/test/kubernetes-exec) -
kubernetes-pod
Tests allow you to create a new Pod for your test, and run a command in there (https://docs.garden.io/reference/action-types/test/kubernetes-pod). Bonsai also has a backwards-compatibility mode, and the bug might also be fixed without rewriting your config to actions. See also https://docs.garden.io/guides/migrating-to-bonsai
7 Views