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 of this condition, you need to understand how your application is deployed, what resources are used, and how it is named and labeled. 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:

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
    1. or search for it.

      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. If necessary, wait for the build to complete.

    Page displays project view of My Node Project
  8. Once 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 it 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 name.

    • The Label credential name is a label name this 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 may display as Unknown for a few moments until it changes to Normal. 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

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

  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 might display as unknown for a few moments until it changes to normal status.

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

Understand the fields in an Application Custom Resource

To add an application to kAppNav, it is important to understand how the following Application Custom Resource Definition is used. For more information, see the Kubernetes Application SIG.

Example of application custom resource
Field definitions
metadata.name

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

metadata.namespace

This must the namespace of your application.

spec.componentKinds.group

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

spec.componentKinds.kind

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

spec.selector.matchLabels

The matchLabels look for 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.

Copied to clipboard
Copy code block

Way to go! What's next?

What could make this guide better?

Raise an issue to share feedback

Create a pull request to contribute to this guide

Need help?

Ask a question on Stack Overflow

Where to next?