Change Default Namespace in Spinnaker

Posted by /home/eirik on Wednesday, June 17, 2020

Today I had to fix a problem with Spinnaker deployments. After a Spinnaker upgrade, a new error popped up

Deploy failed: Error from server (NotFound): error when creating “STDIN”: namespaces “spinnaker” not found

The deployment did not specify a target namespace. My best guess was that somewhere in our Spinnaker stack the default namespace for deployment had changed.

The setup looks like this: Spinnaker (version 1.20.5) deployed on Google Kubernetes Engine using GoogleCloudPlatform/spinnaker-for-gcp.

Spinnaker is using the default namespace specified in the kubectl context. In my case there was no namespace specified.

Using the Google Cloud Shell, navigate to the directory with scripts for manage your install and pull the active configuration:

cd cloudshell_open/spinnaker-for-gcp/scripts/manage/
./pull_config.sh

Use hal to list all accounts:

hal config provider kubernetes account list

Copy the account name and then use it to get more details:

hal config provider kubernetes account get [ACCOUNT NAME]

Copy the values from context and kubeconfigFile

The next step is to use kubectl to specify a specific namespace for the context configuration

export KUBECONFIG=[KUBECONFIG FILE]
kubectl config set-context [CONTEXT] --namespace=default

The final step is to upload the configuraion and apply:

./push_and_apply.sh

After all Spinnaker components has restarted, everything should be fine :-)