rancher: namespace is not being created in a project
What kind of request is this (question/bug/enhancement/feature request): Bug / Question
Steps to reproduce (least amount of steps as possible):
- on a new rancher setup, with a cluster registered and nothing in the default project
- log in via via the rancher CLI (using a non-scoped token)
- on your computer create a folder to run the following yaml files
- download the yaml files from here: https://github.com/dbones-simple-shop/infra/tree/master/k8s
- run “rancher kubectl apply -f .”
Result:
- The namespace is created but “Not In a Project” - see below
- the workloads are always in the default project in a namespace called default - see below
Other details that may be helpful:
if we put all the Yaml into a single file, workloads do not show in rancher initially (they do not show anywhere, we can see them via kubectl)
if we move the data namespace into a project, then all workloads appear.
Environment information
- Rancher version: 2.3.0
- Installation option (single install/HA): single (using both clusters where setup via Vagrant on VirtualBox)
Cluster information
- Cluster type (Hosted/Infrastructure Provider/Custom/Imported): Custom (using the rancher wizzard to setup the network)
- Machine type (cloud/VM/metal) and specifications (CPU/memory): Virtual box, Rancher 2Gb and 1 Node 6gb Ram
- Kubernetes version (use
kubectl version
): 1.15.4
Client Version: version.Info{Major:"1", Minor:"16", GitVersion:"v1.16.1", GitCommit:"d647ddbd755faf07169599a625faf302ffc34458", GitTreeState:"clean", BuildDate:"2019-10-02T17:01:15Z", GoVersion:"go1.12.10", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.4", GitCommit:"67d2fcf276fcd9cf743ad4be9a9ef5828adc082f", GitTreeState:"clean", BuildDate:"2019-09-18T14:41:55Z", GoVersion:"go1.12.9", Compiler:"gc", Platform:"linux/amd64"}
- Docker version (use
docker version
): tested it with 2 verisions
Client: Docker Engine - Community
Version: 19.03.2
API version: 1.40
Go version: go1.12.8
Git commit: 6a30dfc
Built: Thu Aug 29 05:29:11 2019
OS/Arch: linux/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 19.03.2
API version: 1.40 (minimum version 1.12)
Go version: go1.12.8
Git commit: 6a30dfc
Built: Thu Aug 29 05:27:45 2019
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.2.6
GitCommit: 894b81a4b802e4eb2a91d1ce216b8817763c29fb
runc:
Version: 1.0.0-rc8
GitCommit: 425e105d5a03fabd737a126ad93d62a9eeede87f
docker-init:
Version: 0.18.0
GitCommit: fec3683
we initial were using this, and then upgraded to the above:
Client:
Version: 17.06.1-ce
API version: 1.30
Go version: go1.8.3
Git commit: 874a737
Built: Thu Aug 17 22:51:12 2017
OS/Arch: linux/amd64
Server:
Version: 17.06.1-ce
API version: 1.30 (minimum version 1.12)
Go version: go1.8.3
Git commit: 874a737
Built: Thu Aug 17 22:50:04 2017
OS/Arch: linux/amd64
Experimental: false
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 19 (1 by maintainers)
I agree with @gabrielcalderon. For our set-up till now we don’t really need rancher cli but associating a namespace with a project is adding a redundant dependency. Cluster id is retrievable but to retrieve project id we need rancher cli/api. The current annotation
field.cattle.io/projectId=clusterId:projectId
needs to be tweaked a bit to remove this dependency. Since duplicate project names are not allowed anyways something like this should be possible:field.cattle.io/projectName=clusterId:projectName
or betterfield.cattle.io/projectName=clusterName:projectName
We use Jinja templates to deploy our workloads by utilizing environment variables to dictate where namespaces are living. rancherproject has the format
<clusterid>:<projectid>
. We also use Kubeconfig to access our clusters for our service accounts.This also happens if you create a namespace via Kubectl, helm, etc. It has been happening for months but rancher has not fix it.
Solution is easy: Rancher should create any new Namespace in the Default Project unless specified.
I’m suggesting it should work with the project name, but it doesn’t. Rancher expects you to use the Rancher cli for these kind of stuff, no idea why.
Not sure why this was closed. This still occurs in v1.20.8+rke2r1