< img height="1" width="1" style="display:none;" alt="" src="https://px.ads.linkedin.com/collect/?pid=3131724&fmt=gif" />

Add Existing Kubernetes Namespaces to a KubeSphere Workspace

A Kubernetes namespace is a KubeSphere project. If you create a namespace object not from the KubeSphere console, the namespace does not appear directly in a certain workspace. But cluster administrators can still see the namespace on the Cluster Management page. At the same time, you can also place the namespace into a workspace.

This tutorial demonstrates how to add an existing Kubernetes namespace to a KubeSphere workspace.

Prerequisites

  • You need an account granted a role including the permission of Cluster Management. For example, you can log in to the console as admin directly or create a new role with the permission and assign it to an account.

  • You have an available workspace so that the namespace can be assigned to it. For more information, see Create Workspaces, Projects, Accounts and Roles.

Create a Kubernetes Namespace

Create an example Kubernetes namespace first so that you can add it to a workspace later. Execute the following command:

kubectl create ns demo-namespace

For more information about creating a Kubernetes namespace, see Namespaces Walkthrough.

Add the Namespace to a KubeSphere Workspace

  1. Log in to the KubeSphere console as admin and go to the Cluster Management page. Click Projects, and you can see all your projects (i.e. namespaces) running on the current cluster, including the one just created.

  2. The namespace created through kubectl does not belong to any workspace. Click on the right and select Assign Workspace.

    project-page

  3. In the dialog that appears, select a Target Workspace and a Project Manager for the project and click OK.

  4. Go to your workspace and you can see the project on the Projects page.

    workspace-project


Thanks for the feedback. If you have a specific question about how to use KubeSphere, ask it on Slack. Open an issue in the GitHub repo if you want to report a problem or suggest an improvement.