Check out what's in the latest release of Kabanero Learn More

Deploying applications to an alternative namespace

By default, applications are deployed to the same namespace as the Kabanero custom resource (CR) instance, which is the kabanero namespace. However, you can change the configuration so that applications are deployed to a different namespace by following these steps:

  1. Obtain a copy of your current Kabanero CR instance configuration.

    • To obtain a list of all Kabanero CR instances in the kabanero namespace, run the following command:

      oc get kabaneros -n kabanero
    • To obtain the configuration for a specific CR instance, run the following command, substituting <name> for the instance you are targeting:

      oc get kabanero <name> -o yaml > kabanero.yaml

      Note that the default name for the CR instance is also kabanero.

  2. Edit kabanero.yaml and specify the namespaces where you intend to deploy applications, by updating the targetNamespaces attribute. Specify multiple namespaces as a list. The following section of a kabanero.yaml file shows a Kabanero CR instance that supports application deployment to the production and test namespaces:

    kind: Kabanero
      name: kabanero
      namespace: kabanero
      - production
      - test

    For a full list of supported attributes in a kabanero.yaml configuration file, see Kabanero Custom Resource.

    Note: Avoid using the OpenShift Console to edit the Kabanero CR instance. The console may change the apiVersion of the Kabanero CR instance from v1alpha2 to v1alpha1. There is a description of the issue here.

  3. Apply your changes to the Kabanero CR instance. For example, to apply changes to the Kabanero CR instance in the kabanero namespace, run the following command:

    oc apply -f kabanero.yaml -n kabanero
  4. Modify your Appsody application app-deploy.yaml file to use one of the namespaces you configured in the targetNamespaces attribute of the Kabanero CR instance. Here is an example app-deploy.yaml file that deploys the appsody-hello-world application to the test namespace:

    kind: AppsodyApplication
      name: appsody-hello-world
      namespace: test
      applicationImage: docker-registry.default.svc:5000/kabanero/appsody-hello-world
      stack: java-openliberty
      createKnativeService: true
  5. Deploy the application by running a manual pipeline or by using a webhook.

Edit This Page