Add volumes and volumeMounts using spring cloud deployer kubernetes

342 views Asked by At

I am trying to run a spring batch application in Kubernetes which launches N number of worker pods. Each of the worker pod is supposed to read from an input file, and generate and save the output file on disk. I am using spring-cloud-deployer-kubernetes to launch batch workers.
In order to mount volumes I tried adding the following deployer peroperties through application.properties

   spring.cloud.deployer.kubernetes.volumes=[{name: 'mount-dir', persistentVolumeClaim: {claimName: 'batch-pvc'}}]
   spring.cloud.deployer.kubernetes.volumeMounts=[{name: 'mount-dir', mountPath: '/mnt'}]

However, after adding the same, application is unable to boot with the following error:

\nAPPLICATION FAILED TO START\n*\n\nDescription:\n\nFailed to bind properties under 'spring.cloud.deployer.kubernetes.volume-mounts' to java.util.List<io.fabric8.kubernetes.api.model.VolumeMount>:\n\n Reason: No converter found capable of converting from type [java.lang.String] to type [java.util.List<io.fabric8.kubernetes.api.model.VolumeMount>]\n\nAction:\n\nUpdate your application's configuration\n"}

Tech Stack used:

  • Spring Boot: 2.1.9.RELEASE
  • Spring Cloud: 2020.0.1
  • Spring Cloud Deployer Kubernetes: 2.5.0
  • Spring Cloud Task: 2.1.1.RELEASE
  • Kubernetes: 1.21

How can I add volume and volumeMounts to worker pods?

0

There are 0 answers