skip to Main Content

I’ve a Kubernetes cluster running Django on DEBUG=True using ConfigMap and some other secrets using K8’s secrets. The problem I’m having is that even if I rollout the server it keeps having debug true values, and when I inspect the container, the env shows that it’s in False.

Any idea why this is happening, and how to solve it?

EDIT:

Here’s the deployment.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: backend-app
  labels:
    app: backend
spec:
  replicas: 2
  selector:
    matchLabels:
      app: backend
  template:
    metadata:
      labels:
        app: backend
    spec:
      containers:
        - image: <dockerhub_username>/<image>:latest
          name: backend
          envFrom:
          - secretRef:
              name: backend-secret
          - configMapRef:
              name: backend-config
          ports:
            - containerPort: 8000
              name: gunicorn

When I execute kubectl exec -it my-container -- printenv it shows the desired value but it seems the server is missing it.

2

Answers


  1. Chosen as BEST ANSWER

    Just figured it out. I mistakenly was recreating secrets to rollout the deployment while the problem was in configmap, I was not reconfiguring it. Thanks @pwoltschk for the help


  2. so if you redeployed your ConfigMap and afterwards redeployed your pods it will work, except the pods don’t take the value from the configmap.

    First, ensure that you have updated the cm correctly and redeployed the pods

    kubectl delete cm myCM
    
    kubectl create -f myCM.yaml // with correct values
    
    // if you have a deployment it will redeploy you pods if you have deleted them
    kubectl delete pod pod1 pod2 pod3
    

    If this does not work then we know that there is something within the pod or how you consume the cm because It don#t take the value from the cm.

    For a better answer please paste your pod/deployment definition file here.

    From that point, we have two possibilities.

    1. Either the values are not provided accordingly from the pod (Container Level)
    2. Or the values are provided correctly but the application prioritizes another source of values.
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search