Skip to content

HEAL Prerequisites for Kubernetes

Cluster requirements to meet before installing HEAL on Kubernetes or OpenShift.

4 min read Updated SS RS

Purpose#

This guide lists the prerequisites you must meet before installing and configuring HEAL on a Kubernetes or OpenShift cluster.

Deployment Overview#

The diagram below shows a high-level view of HEAL in a Kubernetes environment.

High-level architecture diagram of HEAL in a Kubernetes environment showing K8s Cluster with microservices, HEAL OTel Agents, HEAL K8s Connector, OTel Collector, Data Receiver, OpenSearch, HEAL Dashboards, HAProxy, and Target Servers (VMs)
Kubernetes environment

Kubernetes Prerequisites#

The following are the prerequisites for installing the Kubernetes Connector in HEAL software:

1. Create a service account with cluster-view permissions#

a. Create a new namespace:

oc create namespace heal-monitoring

b. Create a service account:

oc create serviceaccount heal-clusterview-user -n heal-monitoring

b. Bind the account to the cluster-monitoring-view role:

oc adm policy add-cluster-role-to-user cluster-monitoring-view -z heal-clusterview-user -n heal-monitoring

c. Create a secret for the service account:

apiVersion: v1
kind: Secret
metadata:
  name: heal-clusterview-user-secret
  namespace: heal-monitoring
  annotations:
  kubernetes.io/service-account.name: heal-clusterview-user
  type: kubernetes.io/service-account-token

d. Create the cluster role:

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: heal-clusterrole
rules:
- apiGroups: [ "" ]
  resources: [ nodes, services, pods, endpoints ]
  verbs: [ "get", "list", "watch" ]
- apiGroups: [ "extensions" ]
  resources: [ ingresses ]
  verbs: [ "get", "list", "watch" ]

e. Bind the role to the service account:

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: heal-clusterrolebinding
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: heal-clusterrole
subjects:
- kind: ServiceAccount
  name: heal-clusterview-user
  namespace: heal-monitoring

f. Retrieve the token:

oc describe sa heal-clusterview-user -n heal-monitoring
oc describe secret heal-clusterview-user-secret -n heal-monitoring

g. Verify access:

oc login --server=https://<master-url>:<port> --token=<token>
kubectl get pods -n <namespace>

h. Share the token with the HEAL team.

2. Provide cluster configuration details#

Supply the following values during connector configuration:

  • Service Account: A Kubernetes Service Account with cluster view privileges. The service account is used to authenticate the connection between the HEAL server and Kubernetes cluster.
  • Service-account token obtained in the previous section. The service account is used to authenticate the connection between the HEAL server and Kubernetes cluster.
  • Cluster master URL (for example, https://api.cluster.example.com:6443). The Kubernetes Cluster Master URL is required to connect to the Kubernetes API server.
  • Namespaces to monitor.
  • Deployments to monitor.
  • Container image names for each monitored microservice.

3. Network connectivity#

  • The HEAL server must reach the Kubernetes API server and, if used, Prometheus/Thanos Querier endpoints.
  • Confirm DNS resolution and firewall rules before installation.

4. Prometheus access (when credentials are required)#

If Prometheus is secured, repeat the service-account procedure in the openshift-monitoring namespace:

a. Create the account:

oc create serviceaccount srv-heal-mtg -n openshift-monitoring
oc adm policy add-cluster-role-to-user cluster-monitoring-view \
   -z srv-heal-mtg -n openshift-monitoring

b. Retrieve the token:

oc describe sa srv-heal-mtg -n openshift-monitoring
oc describe secret <srv-heal-mtg-****> -n openshift-monitoring

c. Get the route for Thanos Querier:

oc get routes -n openshift-monitoring | grep thanos-querier

d. Share the token and route with the HEAL team.

Reference: To create service accounts, refer to the below documentation link.

https://docs.redhat.com/en/documentation/openshift_container_platform/4.16/html/authentication_and_authorization/understanding-and-creating-service-accounts#service-accounts-overview_understanding-service-accounts

JIM Agent Prerequisites#

Follow these instructions for each Java microservice that requires transaction tracing.

1. Prepare the JIM agent image and update the deployment manifest#

Before you edit the manifest:

a. Obtain the JIM agent container image (jimagent:<version>) from the HEAL team.

b. Push the image to your private or on-prem registry that is reachable by the cluster. 

For example:

harbor.example.com/observability/jimagent:1.22.2.

c. Use the fully qualified path to the local image in the image: field of the initContainer (see step 4).

Then add an initContainer that copies the agent binary:

initContainers:
- name: jimagent
  image: quay.io/heal/jimagent:1.22.2   # Obtain from HEAL
  volumeMounts:
  - mountPath: /healagent
    name: agent-repo
  command: ["/bin/bash", "-c"]
  args: ["cp -r /jim-agent_k8s/. /healagent/"]

2. Set environment variables in the application container#

env:
  # Dynamic pod metadata
  - name: HEAL_POD_NAME
    valueFrom:
      fieldRef:
        fieldPath: metadata.name
  - name: HEAL_POD_UID
    valueFrom:
      fieldRef:
        fieldPath: metadata.uid
  - name: HEAL_POD_NAMESPACE
    valueFrom:
      fieldRef:
        fieldPath: metadata.namespace
  - name: HEAL_NODE_NAME
    valueFrom:
      fieldRef:
        fieldPath: spec.nodeName
  - name: HEAL_POD_IP
    valueFrom:
      fieldRef:
        fieldPath: status.podIP
  # Java agent activation & exporter details
  - name: JAVA_TOOL_OPTIONS
    value: "-javaagent:/healagent/opentelemetry-javaagent-1.22.1.jar"
  - name: OTEL_TRACES_EXPORTER
    value: jaeger
  - name: JIM_CONTROL_CENTER_PROTOCOL
    value: http
  - name: OTEL_EXPORTER_JAEGER_ENDPOINT
    value: "http://<otel-endpoint>:14250"  # Replace with HEAL OTEL endpoint
  # Service metadata
  - name: SERVICE_NAME
    value: <service-name>
  - name: OTEL_RESOURCE_ATTRIBUTES
    value: "service.name=${SERVICE_NAME},agent.uid=${SERVICE_NAME}_${HEAL_POD_NAME}_${HEAL_POD_NAMESPACE}_JIMAgent_txn,instance.uid=${SERVICE_NAME}_${HEAL_POD_NAME}_${HEAL_POD_NAMESPACE}"
  # Optional diagnostics and metrics
  - name: OTEL_JAVAAGENT_DEBUG
    value: "false"
  - name: OTEL_METRICS_EXPORTER
    value: prometheus
  # HTTP header capture (add or remove headers as needed)
  - name: OTEL_INSTRUMENTATION_HTTP_CAPTURE_HEADERS_SERVER_REQUEST
    value: "<Transaction-ID>,Host,traceparent,baggage"
  - name: OTEL_INSTRUMENTATION_HTTP_CAPTURE_HEADERS_SERVER_RESPONSE
    value: "<Transaction-ID>,Host,traceparent,baggage"
  - name: OTEL_INSTRUMENTATION_HTTP_CAPTURE_HEADERS_CLIENT_REQUEST
    value: "<Transaction-ID>,Host,traceparent,baggage"
  - name: OTEL_INSTRUMENTATION_HTTP_CAPTURE_HEADERS_CLIENT_RESPONSE
    value: "<Transaction-ID>,Host,traceparent,baggage"

3. Add volumeMounts to the application container#

Mount the same shared agent-repo volume inside the application container so it can read the agent JAR copied by the initContainer:

volumeMounts:
  - mountPath: /healagent
    name: agent-repo

4. Define the volume#

volumes:
  - name: agent-repo
    emptyDir: {}

5. Expose the metrics port#

Add the following to service.yaml:

ports:
  - name: prometheus-exp
    port: 9464
    targetPort: 9464

6. Configure a ServiceMonitor#

apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  name: <service-monitoring-name>
  namespace: <namespace>
spec:
  selector:
    matchLabels:
      app: <service-name>
  endpoints:
    - port: prometheus-exp
      interval: 60s

Port Access Requirements#

The below ports should be allowed between the OpenShift cluster and HEAL servers:

#SourceSource IPDestination DescriptionDestination IPProtocolPortActionDirectionPurpose & Justification
1OpenShift NodesNode IPs (Master + Infra + Worker + storage)HEAL Server IP’sOTel endpointHTTP14250AllowUnidirectionalTo push application traces to HEAL
2HEAL ServerHEAL IP where the connector is configuredOpenShift ServerOpenShift master URLHTTPS6443 /8443AllowUnidirectionalTo capture Openshift cluster metrics to HEAL
3HEAL ServerHEAL IP where the connector is configuredPrometheusthanos-querier URLHTTPS443AllowUnidirectional