for debug reasons I try to run a container (alpine) via kubectl run and set some Environment vars from ConfigMap or Secret. To do that I understood to use --override= parameter. But if I execute the Container and echo the vars nothing is set. Is my structure of my inline json wrong?
kubectl run --dry-run=client --restart=Never --image=alpine -n app-ns psql-demo --overrides='
{
"apiVersion": "v1",
"spec": {
"env": [
{
"name": "POSTGRES_HOST",
"valueFrom": {
"configMapKeyRef": {
"key": "POSTGRES_HOST",
"name": "db-config"
}
}
}
]
}
}' -o yaml -- sh
I try to check it via echo ${POSTGRES_HOST}.
The ConfigMap config here:
apiVersion: v1
data:
POSTGRES_HOST: db.host.com
kind: ConfigMap
metadata:
labels:
component: postgres
name: db-config
namespace: app-ns
Any idea? Thanks a lot!