<p>I am setting up CI CD pipeline using GitLab. The <code>.gitlab-ci.yml</code> file deployment section is given below.</p>
<pre><code>Deploy to DEV:
  variables:
    GCP_PROJECT_ID: &lt;&gt;
    GOOGLE_IMAGE_NAME: &lt;&gt;
    CLUSTER_NAME: &lt;&gt;
    ZONE: &lt;&gt;
  image: gcr.io/cloud-builders/kubectl
  stage: deploy
  before_script:
    - curl -s &quot;https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh&quot;  | bash
    - mv kustomize /usr/local/bin/
  script:
    - gcloud auth activate-service-account --key-file ${GOOGLE_APPLICATION_CREDENTIALS}
    - gcloud container clusters get-credentials $CLUSTER_NAME --zone $ZONE --project $GCP_PROJECT_ID
    - cd .k8s/overlays/dev
    - kustomize edit set image &lt;IMAGE_NAME&gt;=gcr.io/$GCP_PROJECT_ID/$GOOGLE_IMAGE_NAME:$VERSION-$CI_COMMIT_SHORT_SHA
    - kustomize build . 
    - kustomize build . | kubectl apply -f -
  only:
    refs:
      - merge_request
      - master
  when: manual
</code></pre>
<p>It shows the error <code>Error from server (NotFound): error when creating STDIN: namespaces gitlab-runner not found</code></p>
<p>But I have not defined any namespaces named <code>gitlab-runner</code>. The cluster don't have any namespace with that name. Where is this coming from?</p>

<p>For anyone who is bumping into the same or similar problem, I finally was able to solve it by explicitly mentioning the <code>namespace: default</code> in the Deployment yaml. I thought since the Deployment was in the Default namespace I would not have to specify the namespace. But specifying it solved it for me.</p>
<p>I still don't know what's causing the issue though.</p>
