Ce contenu n'est pas disponible dans la langue sélectionnée.

Chapter 7. Install the Topology plugin


Install and configure the Topology plugin to visualize Kubernetes workloads and manage labels and annotations.

7.1. Install the Topology plugin

Visualize Kubernetes workloads like Deployments, Pods, and Virtual Machines by enabling the Topology plugin.

The Topology plugin enables you to visualize the workloads such as Deployment, Job, Daemonset, Statefulset, CronJob, Pods and Virtual Machines powering any service on your Kubernetes cluster.

Prerequisites

  • You have installed and configured the @backstage/plugin-kubernetes-backend dynamic plugins.
  • You have configured the Kubernetes plugin to connect to the cluster using a ServiceAccount.
  • The ClusterRole must be granted to ServiceAccount accessing the cluster.

    Note

    If you have the Developer Hub Kubernetes plugin configured, then the ClusterRole is already granted.

Procedure

  • The Topology plugin is pre-loaded in Developer Hub with basic configuration properties. To enable it, set the disabled property to false as follows:

    app-config.yaml fragment

    auth:
    global:
      dynamic:
        includes:
          - dynamic-plugins.default.yaml
        plugins:
          - package: ./dynamic-plugins/dist/backstage-community-plugin-topology
            disabled: false

7.2. Configure the Topology plugin

Configure the Topology plugin to view OpenShift routes, pod logs, Tekton PipelineRuns, and virtual machines.

7.2.1. View OpenShift routes

Grant read access to routes resource in ClusterRole to view OpenShift routes in the Topology plugin.

Procedure

  1. To view OpenShift routes, grant read access to the routes resource in the ClusterRole:

      apiVersion: rbac.authorization.k8s.io/v1
      kind: ClusterRole
      metadata:
        name: backstage-read-only
      rules:
        ...
        - apiGroups:
            - route.openshift.io
          resources:
            - routes
          verbs:
            - get
            - list
  2. Also add the following in kubernetes.customResources property in your app-config.yaml file:

    kubernetes:
        ...
        customResources:
          - group: 'route.openshift.io'
            apiVersion: 'v1'
            	  plural: 'routes'

7.2.2. View pod logs

Grant ClusterRole permissions to pods and pods/log resources to view pod logs in the Topology plugin.

Procedure

  • To view pod logs, you must grant the following permission to the ClusterRole:

     apiVersion: rbac.authorization.k8s.io/v1
      kind: ClusterRole
      metadata:
        name: backstage-read-only
      rules:
        ...
        - apiGroups:
            - ''
          resources:
            - pods
            - pods/log
          verbs:
            - get
            - list
            - watch

7.2.3. View Tekton PipelineRuns

Grant ClusterRole access to Tekton resources to view PipelineRuns status in the Topology plugin.

Procedure

  1. To view the Tekton PipelineRuns, grant read access to the pipelines, pipelineruns, and taskruns resources in the ClusterRole:

     ...
      apiVersion: rbac.authorization.k8s.io/v1
      kind: ClusterRole
      metadata:
        name: backstage-read-only
      rules:
        ...
        - apiGroups:
            - tekton.dev
          resources:
            - pipelines
            - pipelineruns
            - taskruns
          verbs:
            - get
            - list
  2. To view the Tekton PipelineRuns list in the side panel and the latest PipelineRuns status in the Topology node decorator, add the following code to the kubernetes.customResources property in your app-config.yaml file:

    kubernetes:
        ...
        customResources:
          - group: 'tekton.dev'
            apiVersion: 'v1'
            plural: 'pipelines'
          - group: 'tekton.dev'
            apiVersion: 'v1'
            plural: 'pipelineruns'
          - group: 'tekton.dev'
            apiVersion: 'v1'
            plural: 'taskruns'

7.2.4. View virtual machines

Grant ClusterRole access to VirtualMachines resources to view virtual machine nodes in the Topology plugin.

Prerequisites

  • The OpenShift Virtualization operator is installed and configured on a Kubernetes cluster.

Procedure

  1. Grant read access to the VirtualMachines resource in the ClusterRole:

     ...
      apiVersion: rbac.authorization.k8s.io/v1
      kind: ClusterRole
      metadata:
        name: backstage-read-only
      rules:
        ...
        - apiGroups:
            - kubevirt.io
          resources:
            - virtualmachines
            - virtualmachineinstances
          verbs:
            - get
            - list
  2. To view the virtual machine nodes on the topology plugin, add the following code to the kubernetes.customResources property in the app-config.yaml file:

    kubernetes:
        ...
        customResources:
          - group: 'kubevirt.io'
            apiVersion: 'v1'
            plural: 'virtualmachines'
          - group: 'kubevirt.io'
            apiVersion: 'v1'
            plural: 'virtualmachineinstances'

7.2.5. Enable the source code editor

Enable the source code editor to allow developers to open source code directly from RHDH.

Procedure

  1. Grant read access to the CheClusters resource in the ClusterRole:

     ...
      apiVersion: rbac.authorization.k8s.io/v1
      kind: ClusterRole
      metadata:
        name: backstage-read-only
      rules:
        ...
        - apiGroups:
            - org.eclipse.che
          resources:
            - checlusters
          verbs:
            - get
            - list
  2. Add the following configuration to the kubernetes.customResources property in your app-config.yaml file:

     kubernetes:
        ...
        customResources:
          - group: 'org.eclipse.che'
            apiVersion: 'v2'
            plural: 'checlusters'

7.3. Manage labels and annotations for Topology plugins

Configure labels and annotations to customize Kubernetes resource identification and visualization in the Topology plugin.

Add annotations and labels to enable RHDH to detect that an entity has Kubernetes components.

Procedure

  1. Add the following annotation to the catalog-info.yaml file of the entity:

    annotations:
      backstage.io/kubernetes-id: <BACKSTAGE_ENTITY_NAME>
  2. Add the following label to the resources so that the Kubernetes plugin gets the Kubernetes resources from the requested entity:

    labels:
      backstage.io/kubernetes-id: <BACKSTAGE_ENTITY_NAME>
    Note

    When using the label selector, the mentioned labels must be present on the resource.

7.3.3. Namespace annotation

Identify Kubernetes resources by namespace using the backstage.io/kubernetes-namespace annotation.

Procedure

  • To identify the Kubernetes resources using the defined namespace, add the backstage.io/kubernetes-namespace annotation:

    annotations:
      backstage.io/kubernetes-namespace: <RESOURCE_NS>

    The Red Hat OpenShift Dev Spaces instance is not accessible using the source code editor if the backstage.io/kubernetes-namespace annotation is added to the catalog-info.yaml file.

    To retrieve the instance URL, you require the CheCluster custom resource (CR). As the CheCluster CR is created in the openshift-devspaces namespace, the instance URL is not retrieved if the namespace annotation value is not openshift-devspaces.

7.3.4. Add a label selector query annotation

Add a custom label selector annotation so that RHDH uses your custom labels to find Kubernetes resources.

Procedure

  1. Add the backstage.io/kubernetes-label-selector annotation to the catalog-info.yaml file of the entity. The label selector takes precedence over the ID annotations:

    annotations:
      backstage.io/kubernetes-label-selector: 'app=my-app,component=front-end'
  2. Optional: If you have many entities while Red Hat Dev Spaces is configured and want multmanyities to support the edit code decorator that redirects to the Red Hat Dev Spaces instance, add the backstage.io/kubernetes-label-selector annotation to the catalog-info.yaml file for each entity:

    annotations:
      backstage.io/kubernetes-label-selector: 'component in (<BACKSTAGE_ENTITY_NAME>,che)'
  3. If you are using the previous label selector, add the following labels to your resources so that the Kubernetes plugin gets the Kubernetes resources from the requested entity:

    labels:
      component: che # add this label to your che cluster instance
    labels:
      component: <BACKSTAGE_ENTITY_NAME> # add this label to the other resources associated with your entity

    You can also write your own custom query for the label selector with unique labels to differentiate your entities. However, you need to ensure that you add those labels to the resources associated with your entities including your CheCluster instance.

7.3.5. Display a runtime icon in the topology node

Add a label to workload resources to display a runtime icon in the topology nodes.

Procedure

  • Add the following label to workload resources, such as Deployments:

    labels:
      app.openshift.io/runtime: <RUNTIME_NAME>

    Alternatively, you can include the following label to display the runtime icon:

    labels:
      app.kubernetes.io/name: <RUNTIME_NAME>

    Supported values of <RUNTIME_NAME> include django, dotnet, drupal, go-gopher, golang, grails, jboss, jruby, js, nginx, nodejs, openjdk, perl, phalcon, php, python, quarkus, rails, redis, rh-spring-boot, rust, java, rh-openjdk, ruby, spring, and spring-boot. Other values result in icons not being rendered for the node.

7.3.6. Group applications in the topology view

Add a label to workload resources to display them in a visual group in the topology view.

Procedure

  • Add the following label to workload resources, such as deployments or pods, to display them in a visual group:

    labels:
      app.kubernetes.io/part-of: <GROUP_NAME>

7.3.7. Node connector

Display visual connectors between workload resources like deployments and pods using annotations.

Procedure

  • To display the workload resources such as deployments or pods with a visual connector, add the following annotation:

    annotations:
      app.openshift.io/connects-to: '[{"apiVersion": <RESOURCE_APIVERSION>,"kind": <RESOURCE_KIND>,"name": <RESOURCE_NAME>}]'
Red Hat logoGithubredditYoutubeTwitter

Apprendre

Essayez, achetez et vendez

Communautés

À propos de Red Hat

Nous proposons des solutions renforcées qui facilitent le travail des entreprises sur plusieurs plates-formes et environnements, du centre de données central à la périphérie du réseau.

Rendre l’open source plus inclusif

Red Hat s'engage à remplacer le langage problématique dans notre code, notre documentation et nos propriétés Web. Pour plus de détails, consultez le Blog Red Hat.

À propos de la documentation Red Hat

Legal Notice

Theme

© 2026 Red Hat
Retour au début