I’m trying to send my kubernetes spec a list. My yaml looks like this:
---
apiVersion: v1
kind: Application
metadata:
name: my-app
spec:
env:
- name: ENV1
value: http://someurl.com
- name: ENV2
value: val2
- name: AN_ENV_LIST
value:
- val2
- val3
But of course I get an error:
invalid type for v1.Application.spec.env.value: got "array", expected "string"
My question is, is this even possible with kubernetes?
How do I specify a list?
And a bonus question – what about maps? Is that possible?
>Solution :
Environment variables are of type string, so you cannot pass an array in a single variable.
You can either encode the array to be a string, but the application must be aware of that encoding. Alternatively pass multiple environment variables, if the application supports that.