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

Using Kubernetes Application Navigator (kAppNav)

duration 25 minutes

What you will learn

You will install a Node.js application to represent a cloud native microservice. Then, you will define an application to provide a single view of the deployed Kubernetes resources of your microservice.

Before you begin

It is important to understand that Kubernetes is a highly flexible system. Many names, labels, and resources are defined and used by convention. Depending on the development tools you use, some names, labels, and resources can vary. kAppNav relies on matching these names, labels, and resources to define and display your application. Because kAppNav does this matching, you need to understand how your application is deployed, what resources are used, and the names that are used. The steps that are described in these instructions work for any Kubernetes environment, but the exact names, labels, and resource kinds can vary based on your application and environment.

Prerequisites

  • You must have one of the following setups:

    • Kabanero Foundation installed which includes kAppNav.

    • Or kAppNav installed separately on a Kubernetes deployment or Minishift cluster.

Create a simple Node.js application

  1. Log into your OpenShift console

  2. From the Service Catalog, create a new Node.js project

  3. Select a Node.js project from the catalog …​

    Select a Node.js project from the catalog
    • OR - search for a Node.js project.

      Search the catalog for a Node.js project
  4. Follow the project creation dialog box to create a new project.

    Create a new project dialog box
  5. Create the Node.js application.

    1. Add to Project: Create Project

    2. Project Name: 'my-node-project' (this will be the application’s namespace)

    3. Project Display Name: 'My Node Project'

    4. Application Name: 'my-node-app'

    5. Git Repository: Click 'Try Sample Repository'

    6. Click Create

      Configure the new node.js project in the dialog box
  6. Close the dialog box and navigate to the newly created My Node Project.

    Dialog displays that the node.js project was created successfully
  7. Navigate to the "My Node Project" project view. Wait, if necessary, for the build to complete.

    Page displays project view of My Node Project
  8. When the build is complete and the pod is deployed, access the application’s URL.

    Page displays link to access application’s url

    The application is now deployed and receiving traffic.

    Page displays message indicating that the application has been deployed

Add the application in kAppNav

To display the application in kAppNav, you can create an Application Custom Resource to group the Kubernetes resources that belong to the deployed microservice.

  1. Find the kAppNav 'kappnav-ui-service' route and click its hostname to open up the kAppNav main page.

    Page displays user interface for create custom resource
  2. Click the Create Application button.

    Click the create application button
  3. On the General tab, specify the application name and namespace.

    • The Name value can be anything and does not need to match the name of the application.

    • The Namespace value must be the same namespace as the projects that make up the application.

    Enter details in the kAppNav user interface for application name and namespace
  4. On the Selectors tab, specify the application label and value.

    • The Label credential name is a label name provided by convention.

    • The Value credential is the application name provided when the application was created.

    Enter details in the kAppNav user interface for application label and value
  5. On the Kinds tab, specify Pod and DeploymentConfig as resource kinds in the resources group.

    Specify resource kinds the resources group
  6. Click Create.

    • The application is created. The status can display as Unknown for a few moments until a change to Normal displays. The Unknown status occurs while kAppNav is interrogating the resources to determine the overall status.

    Page displays the view of a successfully created application
  7. Navigate into the my-node-app application view to see the details and components that define the application.

    Page displays the view of the mynodeapp application view where you can view fields containing the details that define the application

Edit the Application Custom Resource through the GUI

By editing the Application Custom Resource , you can add additional resources, such as services and routes, to the application components.

  1. Navigate into the application.

  2. From the action menu, select Edit to modify the Application Custom Resource as a JSON file.

    Edit the JSON file to modify the application custom resource.
  3. Add additional Kinds to the componentKinds list and click Save.

    Edit the JSON file to additional kinds to the componentKinds list.
  4. kAppNav automatically updates the my-node-app application view to show the added resources. The status of the new resources can display as unknown for a few moments until a normal status displays.

    Edit the JSON file to additional kinds to the componentKinds list.

Understand the fields in an Application Custom Resource

Before adding an application to kAppNav, read and understand how the following Application Custom Resource Definition is used. See the Kubernetes Application SIG.

Example of application custom resource
Field definitions
metadata.name

The display name of your application in kAppNav as well as the name of the application resource. The name must be unique within the namespace.

metadata.namespace

The namespace of your application.

spec.componentKinds.group

The value for the group can be any value. This value does not have a use.

spec.componentKinds.kind

The kind value must be capitalized in order to follow the correct syntax for type references. The resource kinds originate from the underlying application deployment. Depending on how the application is deployed, different resources may be available.

spec.selector.matchLabels

The matchLabels serve to help find existing label name=value pairs which exist on the application and its resources. The app label is a convention and is usually applied to all resources for the same application.

Way to go! What's next?

What could make this guide better?

Raise an issue to share feedback

Edit or create new guides to help contribute

Need help?

Ask a question on Stack Overflow

Where to next?