title: How to Deploy from Gitlab-ci to multiple kubernetes namespaces?
body: <p>I have two variable containing my namespaces names:</p>
  <pre><code>$KUBE_NAMESPACE_DEV =&quot;stellacenter-dev&quot;
  $KUBE_NAMESPACE_STAGE &quot;stellacenter-stage-uat&quot; 
  </code></pre>
  <p>Now I want to modify the following .gitlab-ci.yaml configuration to include the namespace logic:</p>
  <pre><code>deploy_dev:
    stage: deploy
    image: stellacenter/aws-helm-kubectl
    before_script:
      - aws configure set aws_access_key_id ${DEV_AWS_ACCESS_KEY_ID}
      - aws configure set aws_secret_access_key ${DEV_AWS_SECRET_ACCESS_KEY}
      - aws configure set region ${DEV_AWS_DEFAULT_REGION}
    script:
      - sed -i &quot;s/&lt;VERSION&gt;/${CI_COMMIT_SHORT_SHA}/g&quot; provider-service.yml     
      - mkdir -p  $HOME/.kube
      - cp $KUBE_CONFIG_DEV $HOME/.kube/config
      - chown $(id -u):$(id -g) $HOME/.kube/config 
      - export KUBECONFIG=$HOME/.kube/config
      - kubectl apply -f ./provider-service.yml 
    only:
      - developer  
  </code></pre>
  <p>Provide-service.yml file</p>
  <pre><code>apiVersion: apps/v1
  kind: Deployment
  metadata:
    name: provider-app
    namespace: &quot;stellacenter-dev&quot; or &quot;stellacenter-stage-uat&quot; 
    labels:
      app: provider-app
  spec:
    replicas: 1
    selector:
      matchLabels:
        app : provider-app
    template:
      metadata:
        labels:
          app: provider-app
      spec:
        containers:
        - name: provider-app
          image: registry.gitlab.com/stella-center/backend-services/provider-service:&lt;VERSION&gt;
          imagePullPolicy: Always
          ports:
            - containerPort: 8092
        imagePullSecrets:
          - name:  gitlab-registry-token-auth
  
  ---
  
  apiVersion: v1
  kind: Service
  metadata:
    name:  provider-service
    namespace: &quot;stellacenter-dev&quot; &quot;stellacenter-stage-uat&quot; 
  spec:
    type: NodePort
    selector:
      app:  provider-app
    ports:
    - port:  8092
      targetPort:  8092
  </code></pre>
  <p>I don't know how to integrate the variables and the values correctly . I'm facing the error while I run pipeline.Kindly help me to sort it out.</p>