Configmap not getting applied to deployment container (helm chart) as env (using envFrom)

249 views Asked by At

I am facing an issue with helm charts deployments. I am trying to apply configmap to a deployment but containers/app is not getting the env inside the app. I am using this in my deployment.yaml:

          envFrom:
            - configMapRef:
                name: env-configs 

but if i set env using env: it does get the value successfully. here are details:

$kubectl describe pod portal-app-589bb5bbdc-cdxlj
Name:             portal-app-589bb5bbdc-cdxlj
Namespace:        portal
Priority:         0
Service Account:  portal-app
Node:             ip-something.ec2.internal/someip
Start Time:       Thu, 12 Oct 2023 07:28:51 -0500
Labels:           app.kubernetes.io/instance=portal-app
                  app.kubernetes.io/name=portal-app
                  pod-template-hash=589bb5bbdc
Annotations:      kubernetes.io/psp: eks.privileged
Status:           Running
IP:               10.23.9.1
IPs:
  IP:           10.23.9.1
Controlled By:  ReplicaSet/portal-app-589bb5bbdc
Containers:
  maintenance-portal-app:
    Container ID:  docker://d737dd3096693d7d0b
    Image:         26178.dkr.ecr.us-east-1.amazonaws.com/portal:f6628dad
    Image ID:      docker-pullable://26178.dkr.ecr.us-east-1.amazonaws.com/portal@sha256:d737dd3096693d7d0b
    Port:          3000/TCP
    Host Port:     0/TCP
    State:         Waiting
      Reason:      CrashLoopBackOff
    Last State:    Terminated
      Reason:      Error
      Message:     yarn run v1.22.19
$ yarn migrate:all && yarn listMigrations && yarn start
$ knex migrate:latest --knexfile db/knexfile.mjs
Requiring external module /app/node_modules/interpret/mjs-stub
Working directory changed to /app/db
password authentication failed for user "SA_MR_NP"
error: password authentication failed for user "SA_MR_NP"
    at Parser.parseErrorMessage (/app/node_modules/pg-protocol/dist/parser.js:287:98)
    at Parser.handlePacket (/app/node_modules/pg-protocol/dist/parser.js:126:29)
    at Parser.parse (/app/node_modules/pg-protocol/dist/parser.js:39:38)
    at Socket.<anonymous> (/app/node_modules/pg-protocol/dist/index.js:11:42)
    at Socket.emit (node:events:513:28)
    at addChunk (node:internal/streams/readable:315:12)
    at readableAddChunk (node:internal/streams/readable:289:9)
    at Socket.Readable.push (node:internal/streams/readable:228:10)
    at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

      Exit Code:    1
      Started:      Thu, 12 Oct 2023 07:40:07 -0500
      Finished:     Thu, 12 Oct 2023 07:40:08 -0500
    Ready:          False
    Restart Count:  7
    Limits:
      cpu:     1800m
      memory:  4Gi
    Requests:
      cpu:     900m
      memory:  2Gi
    Liveness:  http-get http://:http/api/health-check delay=60s timeout=1s period=10s #success=1 #failure=3
    Startup:   http-get http://:http/api/health-check delay=10s timeout=1s period=10s #success=1 #failure=5
    Environment Variables from:
      env-configs  ConfigMap  Optional: false

here is configmap details:

kubectl describe configmaps env-configs
Name:         env-configs
Namespace:    portal
Labels:       app=env-configs
              app.kubernetes.io/managed-by=Helm
Annotations:  meta.helm.sh/release-name: env-configs
              meta.helm.sh/release-namespace: portal

Data
====
DB_PASSWORD:
----
'XXXXXXXXXXX'
GIT_SHA:
----
'109fda6b'

tried updating helm charts to debug but no luck.

0

There are 0 answers