System Diagnostics: Kubernetes API Integration¶
This document describes how to enable and configure the System Diagnostics feature to access the Kubernetes API from the backend pod. This integration allows the System Diagnostics feature to collect detailed information about the Lightrun deployment's Kubernetes environment.
Overview¶
The System Diagnostics feature can be configured to access the Kubernetes API from the backend pod to enhance its diagnostic capabilities. This integration provides valuable insights into the Kubernetes environment where Lightrun is deployed, enabling more comprehensive system monitoring and troubleshooting.
Prerequisites¶
Before enabling this feature, ensure that:
- The
serviceAccount.create
setting is set totrue
in your values.yaml - Your Kubernetes cluster allows service account token mounting
- You have the necessary permissions to create Roles and RoleBindings in the namespace where Lightrun is deployed
Configuration¶
To enable Kubernetes API access, set the following in your values.yaml:
general:
system_diagnostics_k8s_api:
enabled: true
How It Works¶
When enabled, this feature:
-
Creates a Role and RoleBinding that grant the backend pod permission to:
- List and get resources in the Lightrun namespace
- Access basic cluster information
-
Mounts the service account token to the backend pod, allowing it to authenticate with the Kubernetes API
-
Enables the backend to collect system diagnostics data about:
- Pod status and resource usage
- Node information
- Cluster events
- Resource limits and requests
Security Considerations¶
⚠️ Important Security Notes:
- This feature requires mounting a service account token inside the pod, which may not be allowed in all environments
- The service account token provides access to Kubernetes API resources within the namespace
- Consider the security implications before enabling this feature in production environments
- Review your cluster's security policies regarding service account token mounting
Troubleshooting¶
If the feature is not working as expected:
- Verify that
serviceAccount.create
is set totrue
- Check that the service account token is properly mounted in the backend pod
- Ensure the Role and RoleBinding were created successfully
- Review the backend pod logs for any authentication or authorization errors
Disabling the Feature¶
To disable Kubernetes API access:
general:
system_diagnostics_k8s_api:
enabled: false
Note: Disabling this feature only affects the Kubernetes API data collection. Other system diagnostics features will continue to work as normal.