title: How to update Kubernetes secrets for all namespaces
body: <p>I am using docker and kubernetes on Google Cloud Platform, with the Kubernetes Engine.
  I have secrets configurated in a app.yaml file like so :</p>
  
  <pre><code>apiVersion: extensions/v1beta1
  kind: Deployment
  metadata:
    name: app
    namespace: $CI_COMMIT_REF_SLUG
    labels:
      app: app
  spec:
    replicas: 1
    template:
      metadata:
        labels:
          app: app
      spec:
        containers:
        - name: app
          image: gcr.io/engagement-org/app:$CI_COMMIT_SHA
          imagePullPolicy: Always
          ports:
          - containerPort: 9000
          env:
          - name: MAILJET_APIKEY_PUBLIC
            valueFrom:
              secretKeyRef:
                name: mailjet
                key: apikey_public
          - name: MAILJET_APIKEY_PRIVATE
            valueFrom:
              secretKeyRef:
                name: mailjet
                key: apikey_private
  </code></pre>
  
  <p>Each time I push on a new branch, a new namespace is created through a deploy in my gitlab-ci file. Secrets are created like so :</p>
  
  <pre><code> - kubectl create secret generic mailjet --namespace=$CI_COMMIT_REF_SLUG --from-literal=apikey_public=$MAILJET_APIKEY_PUBLIC --from-literal=apikey_private=$MAILJET_APIKEY_PRIVATE || echo 'Secret already exist'; 
  </code></pre>
  
  <p>Now, I have updated my mailjet api keys and want to make the change to all namespaces.
  I can edit the secret on each namespace by getting a shell on the pods and running <code>kubectl edit secret mailjet --namespace=&lt;namespace_name&gt;</code></p>
  
  <p>What I want is to send the new secret values to the new pods that will be created in the future. When I deploy a new one, it still uses the old values.</p>
  
  <p>From what I understand, the gitlab-ci file uses the app.yaml file to replace the environment variables with values. But I don't understand where app.yaml finds the original values.</p>
  
  <p>Thank you for your help.</p>