# System/Default Namespaces are not in a Project

**URL:** https://forums.suse.com/t/system-default-namespaces-are-not-in-a-project/13330
**Category:** SUSE Rancher Prime
**Created:** [February 14, 2019, 11:34am UTC](https://forums.suse.com/t/system-default-namespaces-are-not-in-a-project/13330 "2019-02-14T11:34:01Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![p7k](https://avatars.discourse-cdn.com/v4/letter/p/85f322/32.png) [@p7k](https://forums.suse.com/u/p7k)
#### Post date: [February 14, 2019, 11:34am UTC](https://forums.suse.com/t/system-default-namespaces-are-not-in-a-project/13330/1 "2019-02-14T11:34:01Z")

</div>

Hi all,

i am trying to automate my Rancher setups. I works quite well except one small problem. If i create a new cluster with some simple API calls the cluster will be created but all namespaces (kube-system, cattle-system, default) are not in a project after the nodes joined the new cluster. But if i create a new cluster in the webui it all works fine. So i think i am missing something but i can’t find it.

Rancher: v2.1.6

Here is an example API call

```
 curl -u "${CATTLE_ACCESS_KEY}:${CATTLE_SECRET_KEY}" \
-X POST \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-d '{"amazonElasticContainerServiceConfig":null, "azureKubernetesServiceConfig":null, "description":"Dev Cluster", "dockerRootDir":"/var/lib/docker", "googleKubernetesEngineConfig":null, "name":"dev", "rancherKubernetesEngineConfig":{}}' \
'https://localhost:8443/v3/clusters'

```

HTTP Request:

```
HTTP/1.1 POST /v3/clusters
Host: localhost:8443
Accept: application/json
Content-Type: application/json
Content-Length: 226

{

    "amazonElasticContainerServiceConfig": null,
    "azureKubernetesServiceConfig": null,
    "description": "Dev Cluster",
    "dockerRootDir": "/var/lib/docker",
    "googleKubernetesEngineConfig": null,
    "name": "dev",
    "rancherKubernetesEngineConfig": { }

}

```

Do you have any idea what is missing? I know i can move namespace manually but i am trying to understand what’s going wrong.

Thank you very much.

 ![not_in_a_project](https://us1.discourse-cdn.com/flex022/uploads/suse/original/2X/c/c3de43b48a84ae898dde5756369a7bf1758ad7c4.png)

Best regards

---

<div class="post-metadata">

### Author: ![p7k](https://avatars.discourse-cdn.com/v4/letter/p/85f322/32.png) [@p7k](https://forums.suse.com/u/p7k)
#### Post date: [February 14, 2019, 12:03pm UTC](https://forums.suse.com/t/system-default-namespaces-are-not-in-a-project/13330/2 "2019-02-14T12:03:01Z")

</div>

I think the problem is that the projectId value and the “[field.cattle.io/projectId](http://field.cattle.io/projectId)” label which does not match the real project id (“p-vxvb8”) and the real cluster id (“c-896jz”)

```
"id": ["cattle-system"],
"labels": {
  "field.cattle.io/projectId": "p-k9bb4"
},
projectId": "c-sr7hw:p-k9bb4",

"id": ["kube-system"],
"labels": {
  "field.cattle.io/projectId": "p-k9bb4"
},
projectId": "c-sr7hw:p-k9bb4",

```

But why? 🤔

---

<div class="post-metadata">

### Author: ![naorw](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/naorw/32/4953_2.png) [@naorw](https://forums.suse.com/u/naorw)
#### Post date: [March 21, 2019, 12:22pm UTC](https://forums.suse.com/t/system-default-namespaces-are-not-in-a-project/13330/3 "2019-03-21T12:22:47Z")

</div>

Hi, p7k  
Have same problem after importing a cluster to new Rancher server.  
wrong project id. can not move namespaces, can not change via web interface to api.  
Did you manage to figure it out?  
N

Just an update. My issue happened during migration from one rancher cluster to another.

Namespaces seem to contain invalid projectID. in format:  
“projectId”: “existing\_cluster:notexisting\_project”

I was able to use

kubectl annotate --overwrite namespace existing\_namespace [field.cattle.io/projectId=existing\_cluster:existing\_project](http://field.cattle.io/projectId=existing_cluster:existing_project)

---

<div class="post-metadata">

### Author: ![p7k](https://avatars.discourse-cdn.com/v4/letter/p/85f322/32.png) [@p7k](https://forums.suse.com/u/p7k)
#### Post date: [March 27, 2019, 9:53pm UTC](https://forums.suse.com/t/system-default-namespaces-are-not-in-a-project/13330/4 "2019-03-27T21:53:48Z")

</div>

Hi naorw,

i think my problem was related to some old files which i did not clean up during my tests. I wrote an Ansible Playbook to clean them but i missed a directory. I could’nt reproduce it with a new node.
