I'm using Gitlab autodevops with a Kubernetes cluster(Gitlab runner with the Kubernetes Executor).
A while ago the deployments used to be in project specific namespaces like project-5648-nut-qa-9yg86f
, but now they are deployed in default
.
The namespace is determined with KUBE_NAMESPACE
which should be automatically set by gitlab accoriding to the docs.
I created a simple Job to get the environment variables:
env build:
extends: .auto-deploy
stage: build
tags:
- nut
script:
- env
- auto-deploy ensure_namespace
environment:
name: nut/staging
url: https://$CI_PROJECT_PATH_SLUG.nut.$KUBE_INGRESS_BASE_DOMAIN
But there is no variable called KUBE_NAMESPACE
in there and auto-deploy ensure_namespace
uses the default
namespace
$ auto-deploy ensure_namespace
NAME STATUS AGE
default Active 230d
Why is KUBE_NAMESPACE
not set?
The server with the cluster has been rebooted a few times.
Everytime it reboots a new runner is created, is it possible that this is the cause of the error?
And how can I get a value for KUBE_NAMESPACE
again?