Why are namespaces created via the kubectl CLI not assigned to a project?

This document (000020218) is provided subject to the disclaimer at the end of this document.

Situation

Question

When a user creates a Kubernetes namespace via the Rancher UI, API or CLI the namespace is created within a specified Rancher project in the cluster; however, when a user creates a namespace via the kubectl CLI (kubectl create ns <namespace>) it is created outside of any project, why is this?

Pre-requisites

  • A cluster managed via Rancher v2.x

Answer

It is expected behaviour that namespaces created via the kubectl CLI are created outside of a Project. Projects are Rancher abstractions and do not exist natively within the Kubernetes, as a result when you create a namespace via the kubectl CLI (or by otherwise POST'ing directly to the kube-apiserver) it is not associated with any project in Rancher.

If you wish to create namespaces within a Rancher Project with a command-line tool, then you should use the Rancher CLI (https://rancher.com/docs/rancher/v2.x/en/cli/ ).

Where a namespace has been created outside a project via kubectl, a cluster admin can move the namespace into a project, within the 'Projects/Namespaces' view for the cluster.

Disclaimer

This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.

  • Document ID:000020218
  • Creation Date: 19-Jul-2021
  • Modified Date:19-Jul-2021
    • SUSE Rancher

< Back to Support Search

For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com

SUSE Support Forums

Get your questions answered by experienced Sys Ops or interact with other SUSE community experts.

Join Our Community

Support Resources

Learn how to get the most from the technical support you receive with your SUSE Subscription, Premium Support, Academic Program, or Partner Program.


SUSE Customer Support Quick Reference Guide SUSE Technical Support Handbook Update Advisories
Support FAQ

Open an Incident

Open an incident with SUSE Technical Support, manage your subscriptions, download patches, or manage user access.

Go to Customer Center