---
schema_version: "1"
id: 1b770980258fff51a1d2791c9c37ec5302a11de963c1850ab02a786bda74a716
title: Creating Namespaces for Application Deployments
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/runtime-fabric/latest/create-custom-namespace.md
canonical_url: https://docs.mulesoft.com/runtime-fabric/latest/create-custom-namespace
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 5869490d3980ff58640c93f0fc99163075dba358330c468af26c72ecb4af3acf
description: MuleSoft Documentation Site
release: "3.0"
latest: true
---
---
product: Runtime Fabric
version: 3.0
is-latest-version: true
---

# Creating Namespaces for Application Deployments

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

Anypoint Runtime Fabric version 1.12 or later enables you to create your own namespaces for
application deployments.

When you deploy an application into an Anypoint Platform environment, Runtime Fabric creates a new
default namespace using the identifier of the environment. However, if you can create or modify a
namespace with the appropriate Kubernetes labels, Runtime Fabric deploys applications into that
namespace instead of into the default namespace.

## Create A Namespace

1.  As a user with permissions to create a namespace, log in to a Kubernetes workstation.

2.  Run the following commands:

    ```copy
    kubectl create ns <app_namespace>
    kubectl label ns <app_namespace> rtf.mulesoft.com/agentNamespace=<rtf_namespace> rtf.mulesoft.com/role=workers rtf.mulesoft.com/envId=<environment_id> rtf.mulesoft.com/org=<org_id>
    ```

    - Replace `<app_namespace>` with the name of your namespace.

    - Replace `<rtf_namespace>` with the name of the namespace containing the RTF agent.

    - Replace `<environment_id>` with the correct ID for your environment.

    - Replace `<org_id>` with the correct ID for your Business Group.

After you run these commands, any application deployed into an Anypoint Platform environment
identified by `<environment_id>` and `<org_id>` is created inside the `<app_namespace>` namespace by
the RTF agent running in the `<rtf_namespace>`. Before you deploy any applications into the new
namespace, delete any autogenerated namespaces and any applications in them that use the same
environment ID as the new namespace. Do not use the <rtf\_namespace> to deploy your Mule app.

## Troubleshooting Custom Namespaces

If you encounter errors when attempting to create namespaces for Runtime Fabric, troubleshoot them
as follows.

### More Than One Namespace Uses the Same Environment ID

Imagine that you created more than one namespace using the same environment ID, as shown in the
following example:

```copy
$ kubectl get ns custom-namespace-1 -oyaml
labels:
    rtf.mulesoft.com/envId: b164ad54-7e15-4c8b-a7ab-18011a361d81
    rtf.mulesoft.com/role: workers
    rtf.mulesoft.com/agentNamespace=rtf
    rtf.mulesoft.com/org=70be136d-28ec-4395-883f-e5b777a00abc

$ kubectl get ns custom-namespace-2 -oyaml
labels:
    rtf.mulesoft.com/envId: b164ad54-7e15-4c8b-a7ab-18011a361d81
    rtf.mulesoft.com/role: workers
    rtf.mulesoft.com/agentNamespace=rtf
    rtf.mulesoft.com/org=70be136d-28ec-4395-883f-e5b777a00abc
```

In such cases, Runtime Fabric fails the deployment and creates an error message in Runtime Manager.

Before you delete a namespace, ensure that you have not deployed any production applications into
that namespace.
