Namespaces in your container environment

How to administer API Connect in a namespace-scoped container environment.

Namespaces are used in Kubernetes to allow separate groups of resources to run in the same Kubernetes cluster without interfering with each other. For example, you can have two Kubernetes pods with an identical name if they are in different namespaces.

When you install API Connect, you can use an existing namespace or create a new namespace for your API Connect installation to run in.

Cluster-scoped resources are Kubernetes resources that operate across multiple namespaces. The API Connect operator is installed at cluster-scope, and can manage multiple API Connect installations that are installed in different namespaces.

Whenever you run the kubectl command, you must specify which namespace the command is to run in. For example:
kubectl -n <namespace> get pods
where -n <namespace> defines the namespace to run the command in. If you specify the wrong namespace, the kubectl command fails:
kubectl -n wrong-ns get pod mypod
Error from server (NotFound): namespaces "wrong-ns" not found

Kubernetes and OpenShift have a default namespace that is used if no namespace is specified in kubectl commands. It is not recommended to install API Connect in the default namespace. Always create a dedicated namespace for each API Connect installation.

Throughout this document, kubectl commands are provided to run the various installation and maintenance operations that are used to manage your API Connect installation. For brevity, the -n <namespace> is not included in the example commands where the namespace to specify is clear from the context.

If you need to run a sequence of kubectl commands in the same namespace, you can set the default namespace so that you do not need to include -n <namespace> in the commands. To set the default namespace, run the following command:
  • Kubernetes:
    kubectl config set-context --current --namespace=<namespace>
  • OpenShift:
    oc project <namespace>