TX Prevent on Kubernetes : Helm installation guide
π Introduction
This document will guide you through an installation of TX Prevent into your Kubernetes environment.
βΈοΈ Helm chart
ThreatX maintains a Helm chart to provide the best installation experience. If you are not familiar with Helm, take a moment to familiarize yourself with the Helm documentation.
π Prerequisites
-
Kubernetes version
>=1.27.0-0
$ kubectl version
Client Version: v1.30.1 Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3 Server Version: v1.29.4-eks-036c24b
π₯ Install TX Prevent
A helm chart named threatx-prevent
installs the ThreatX Control Plane Services and Sensor Sidecar Injector into the threatx
namespace of the Kubernetes cluster.
$ helm upgrade --namespace threatx \
--create-namespace --install --debug \
--set apiKey=<SENSOR_KEY> \ (1)
--set customer=<TENANT> \ (2)
--set analyzer.tags=<CLUSTER_TAGS> \ (3)
--set certManager.enabled=true \ (4)
threatx-prevent oci://public.ecr.aws/threatx/helm/threatx-prevent
1 | The <SENSOR_KEY> authenticates the product’s component connections with ThreatX Gateway. It should not to be confused with a user’s key to the ThreatX API. See Generating & revoking sensor API keys. |
2 | The <TENANT> is your ThreatX tenant (customer) name. |
3 | Tag values for the analyzer instances. See Analyzer Tags |
4 | The TX Prevent services requires TLS. Use Cert Manager (true ) or Helm Long-Term Self-Signed Certificate Provisioning (false ). |
Helm Tips
|
π€ Uninstall TX Prevent
The commands in this section demonstrate complete removal of the TX Prevent control plane and sensors from your Kubernetes cluster
$ helm -n threatx uninstall threatx-prevent
$ kubectl delete namespace threatx
Sensor containers will not be removed until the application pods are restarted. |
$ kubectl -n my-namespace rollout restart deployment/my-application
π Upgrading TX Prevent
Use helm upgrade
to upgrade your version of TX Prevent.
Sensor Upgrades
Since sensors run as containers in your application pods you will need to restart those pods to get a new sensor version injected into them.
$ kubectl -n my-namespace rollout restart deployment/my-application
The ThreatX Prevent Helm chart can also be configured to do rolling restarts of your application deployments during the upgrade. A set of namespaces and deployments within those namespace can be specified in the podRestart
properties and the Helm upgrade command will perform rolling restarts of those using Helm post-upgrade hooks.
podRestart:
enabled: true
items:
<app-namespace>:
deployments:
- <app-deployment-name>
<another-app-namespace>:
deployments:
- <app-deployment-name>
- <another-app-deployment-name>
π§ Configuration
This section will help you setup the Control Plane Services, enable Sensor Sidecar Injector, provision TLS certificates and define the application name.
π Certificates
Communication between the ThreatX Prevent components use TLS for security. This requires the use of certificates. We provide several different options around certificate management.
π¦ Using the cert-manager Component
If cert-manager is installed in your cluster you can enable the install to use it for certificate provisioning and management.
certManager.enabled: true
π Self-Signed Certificates
You can choose to have the Helm chart create self-signed certificates on installation.
certManager.enabled: false
π Certificate Renewal
The self-signed certificates created on install are good for 2 years. To renew the self-signed certificates perform a helm upgrade
with a configuration property of renewCerts=true
. After the upgrade command runs you will need to restart the control plane services:
$ kubectl -n threatx rollout restart deployment/threatx-analyzer
$ kubectl -n threatx rollout restart deployment/threatx-sts
All application pods with sensors will also need to be restarted (See Upgrading TX Prevent)
π External Secrets
You can also choose to manage the product certificate secrets outside of the Helm chart, you must use these Kubernetes secret names and set the externalSecret
property to true
.
Certificate Authority (CA) Names |
|
TLS Secret (certificate) Names |
|
externalSecrets:
enabled: true
π Self Managed Certificates
If you want to self provision the product certificates and then pass them into the installation you can use the following properties.
These values must be provided as base64 encoded strings. |
# For self-managed Analyzer certificates
analyzer:
caCert:
serverCert:
serverfKey:
# For self-managed STS certificates
sts:
caCert:
serverCert:
serverfKey:
π‘ Analyzer & Scanning Template Service (STS)
π·οΈ Application Name
For the most accurate tracking of events at the application level the ThreatX Protect sensor needs to derive the name of the application that it is monitoring in the pod. This is done by looking at the pod labels.
The applicationNameLabels
property in the Helm chart is a list of pod label names that are used to derive the application name. The default list is:
-
app.kubernetes.io/name
-
app
-
name
If your application uses a different pod label for the application name, you can add it to the list as a helm configuration property.
π·οΈ Analyzer Tags
The tagging of analyzer instances is done with the analyzer.tags
property. The value of this should be a comma-separated list of strings that can identify the set of analyzers in a particular deployment.
analyzer.tags=production
analyzer.tags=production,pci,east
These tags are visible in the CtrlX Sensor Dashboard
Each of the Deployed Sensors represents a single instance of an Analyzer, which in turn can have multiple connected sensors. |
ποΈ Analyzer event sampling
The analyzer.enableSampling
property controls the sampling of API Analyzer events.
When enabled, it caches duplicate API Analyzer Events to reduce the number reported to the ThreatX backend. It is enabled by default to reduce egress traffic
We recommend setting the sampling to false
when initially testing out a deployment, but then flipping it back to true
after the deployment has been verified.
π Runtime Sensor Deployment
π Sidecar Injector
The Sidecar Injector is a Kubernetes Mutating Admission Webhook service that will inject ThreatX runtime sensor containers into application pods based upon the presence of a pod label.
π‘οΈ Adding a sensor to an application
inject-threatx-sidecar: "true"
apiVersion: v1
kind: Pod
metadata:
labels:
app: sample-app
inject-threatx-sidecar: "true"
name: sample-app
namespace: sample
spec:
containers:
- name: sample-app
# ...
This label should typically be added to the application’s Kubernetes Deployment, Statefulset, or Daemonset resource. This will ensure that all created pods by that resource get a sensor injected.
apiVersion: apps/v1
kind: Deployment
metadata:
name: sample-app
namespace: sample
spec:
progressDeadlineSeconds: 600
replicas: 2
selector:
matchLabels:
app: sample-app
template:
metadata:
labels:
app: sample-app
inject-threatx-sidecar: "true"
spec:
containers:
- name: dvwa
# ...
Simply adding the label to a resource with pre-existing pods will not automatically inject those pods; you will need to restart them (e.g. with kubectl rollout restart and so on). This is because Kubernetes does not call the webhook until it needs to start the underlying resources.
|
config.threatx.io/admission-webhooks: disabled
Sidecar injection is always disabled for the kube-system namespace.
|
β Verifying a sensor is running
The sensor can be verified after injection by describing the application pod. The public.ecr.aws/threatx/threatx-runtime-sensor
image should be seen running inside the pod.
Appendix A: ποΈ Helm Chart Configuration Reference
Key | Type | Default | Description |
---|---|---|---|
|
string |
"" |
Your ThreatX api key |
|
string |
"" |
Your ThreatX customer ID |
|
boolean |
false |
Use your cluster’s cert-manager component to provision certificates for the sidecar injector. See Certificates |
|
boolean |
true |
Install the Runtime Analyzer service |
|
int |
2 |
The number of Analyzer instances to run |
|
string |
public.ecr.aws/threatx/threatx-runtime-analyzer" |
Runtime Analyzer image repository |
|
string |
1.2.0 |
Runtime Analyzer image tag |
|
string |
"IfNotPresent" |
Runtime Analyzer image pull policy. See Image Pull Policy for more information. |
|
string |
threatx-grpc2kafka-production-v1.xplat-production.threatx.io |
The hostname of the ThreatX gateway server |
|
string |
"" |
Tags for your ThreatX analyzers which are visible in the CtrlX dashboard |
|
boolean |
true |
TLS enabled for sensor to analyzer communication |
|
boolean |
false |
The secrets for the analyzer will be managed outside of the Helm chart. See External Secrets |
|
string |
"" |
The base64 encoded CA pem to use for the Analyzer. See Self Managed Certificates |
|
string |
"" |
The base64 encoded CA pem to use for the Analyzer. See Self Managed Certificates |
|
string |
"" |
The base64 encoded CA pem to use for the Analyzer. See Self Managed Certificates |
|
string |
"NoneStsClient" |
ThreatX STS service output target |
|
boolean |
false |
compress the API Analyzer Events sent from the Analyzer to STS |
|
boolean |
false |
allow compressed events from STS |
|
boolean |
true |
cache duplicate API Analyzer Events to reduce the number sent to the ThreatX backend |
|
string |
"ApiAnalyzerEventClient" |
Client sink name |
|
int |
443 |
The port number of the STS service |
|
boolean |
true |
Enable TLS with the STS service |
|
string |
"info" |
The logging level |
|
int |
1 |
The logging backtrace level |
|
string |
"500m" |
Amount of CPU units that the Runtime Analyzer container requests for scheduling. See Requests and Limits for more information. |
|
string |
"500Mi" |
Amount of memory that the Runtime Analyzer container requests for scheduling. See Requests and Limits for more information. |
|
string |
"2" |
Maximum amount of CPU units that the Runtime Analyzer container can use. See Requests and Limits for more information. |
|
string |
"2G" |
Maximum amount of memory that the Runtime Analyzer container can use. Requests and Limits for more information. |
|
boolean |
true |
Create a horizontalpodautoscaler for the Runtime Analyzer service |
|
int |
2 |
The minimum number of Runtime Analyzer instances to run |
|
int |
6 |
The maximum number of Runtime Analyzer instances to run |
|
int |
200 |
The percentage of the request cpu limit (analyzer.resources.requests.cpu) to use as a scaling threshold. See: How does a horizontalpodautoscaler work |
|
boolean |
true |
Install the Threatx OTEL service |
|
string |
"" |
The hostname of the ThreatX OTEL server that will receive log and event data |
|
Options for the Grafana Alloy Helm Chart, See: grafana.com/docs/alloy/latest/configure/kubernetes |
||
|
string |
public.ecr.aws/threatx/threatx-runtime-sensor" |
ThreatX Prevent sensor image repository |
|
string |
1.2.0 |
ThreatX Prevent sensor image tag |
|
string |
"IfNotPresent" |
ThreatX Prevent sensor image pull policy. See Image Pull Policy for more information. |
|
list |
["app.kubernetes.io/name","app","name"] |
List of pod labels to use for deriving the pod’s application name. See Sensor Tags |
|
string |
"eth0" |
The host network interface name. |
|
string |
"/sys" |
The host tracing path. S |
|
string |
"info" |
The logging level |
|
int |
1 |
The logging backtrace level |
|
string |
"k8s-sidecar" |
The target environment that the sensor will be running in |
|
string |
"100m" |
Amount of CPU units that the ThreatX Prevent sensor container requests for scheduling. See Requests and Limits for more information. |
|
string |
"250Mi" |
Amount of memory that the ThreatX Prevent sensor container requests for scheduling. See Requests and Limits for more information. |
|
string |
"250m" |
Maximum amount of CPU units that the ThreatX Prevent sensor container can use. See Requests and Limits for more information. |
|
string |
"250Mi" |
Maximum amount of memory that the ThreatX Prevent sensor container can use. See Requests and Limits for more information. |
|
boolean |
true |
Install the ThreatX Prevent Scan Template Service (STS) |
|
int |
2 |
The number of Scan Template Service instances to run |
|
string |
public.ecr.aws/threatx/threatx-sts" |
Scan Template Service image repository |
|
string |
1.1.0 |
Scan Template Service image tag |
|
string |
"IfNotPresent" |
Scan Template Service image pull policy. See Image Pull Policy for more information. |
|
boolean |
true |
TLS enabled |
|
string |
"50051" |
The gRPC listener port |
|
boolean |
false |
The secrets for the STS will be managed outside of the Helm chart. See External Secrets |
|
string |
"" |
The base64 encoded CA pem to use for the STS. See Self Managed Certificates |
|
string |
"" |
The base64 encoded CA pem to use for the STS. See Self Managed Certificates |
|
string |
"" |
The base64 encoded CA pem to use for the STS. See Self Managed Certificates |
|
string |
"info" |
The logging level |
|
string |
"500m" |
Amount of CPU units that the STS container requests for scheduling. See Requests and Limits for more information. |
|
string |
"500Mi" |
Amount of memory that the STS container requests for scheduling. See Requests and Limits for more information. |
|
string |
"2" |
Maximum amount of CPU units that the STS container can use. See Requests and Limits for more information. |
|
string |
2G" |
Maximum amount of memory that the STS container can use. See Requests and Limits for more information. |
|
boolean |
true |
Create a horizontalpodautoscaler for the STS service |
|
int |
2 |
The minimum number of STS instances to run |
|
int |
6 |
The maximum number of STS instances to run |
|
int |
200 |
The percentage of the request cpu limit (sts.resources.requests.cpu) to use as a scaling threshold. See: kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#how-does-a-horizontalpodautoscaler-work |
|
boolean |
true |
Install the ThreatX Prevent Sidecar Injector service |
|
string |
public.ecr.aws/threatx/threatx-sidecar-injector" |
ThreatX Prevent sidecar injector image repository |
|
string |
1.1.0 |
ThreatX Prevent sidecar injector image tag |
|
string |
"IfNotPresent" |
ThreatX Prevent sidecar injector image pull policy. See Image Pull Policy for more information. |
|
string |
"100m" |
Amount of CPU units that the ThreatX Prevent sidecar injector container requests for scheduling. See Requests and Limits for more information. |
|
string |
"100Mi" |
Amount of memory that the ThreatX Prevent sidecar injector container requests for scheduling. See Requests and Limits for more information. |
|
string |
"200m" |
Maximum amount of CPU units that the ThreatX Prevent sidecar injector container can use. See Requests and Limits for more information. |
|
string |
"200Mi" |
Maximum amount of memory that the ThreatX Prevent sidecar injector container can use. See Requests and Limits for more information. |
|
boolean |
false |
Regenerate certificates for the control plane services. |