Documentation
Setup instructions
KestreLynx runs as one container per Docker host or as a single-replica Deployment inside a Kubernetes cluster. It can also scan a Kubernetes cluster by connecting to its API server from a Docker container outside the cluster.
It discovers and scans the images used by running containers, then sends the results to Slack, email, or a webhook.
Requirements
- An environment suited to how you run KestreLynx:
- To scan a Docker host, a Docker host with Docker Compose or the Docker CLI
- To run inside a Kubernetes cluster, a cluster with
kubectlaccess and persistent storage - To connect from outside a Kubernetes cluster, a cluster with
kubectlaccess and a Docker host with the Docker CLI and access to the API server
- At least one of the following notification destinations:
- Slack Incoming Webhook
- Slack bot token and channel
- Webhook URL
- Email over TLS-only SMTP
Prepare the configuration
Create a config.yml file for use with Docker, Docker Compose, or connections from outside a Kubernetes cluster.
-
Download or clone the repository, then create
config.yml. -
Configure at least one notification destination under
notifyin theconfig.ymlfile created in step 1.
Run with Docker
Run the following commands in the directory containing the config.yml file created in Prepare the configuration to start KestreLynx and check the logs.
docker run -d --name kestrelynx \
--restart unless-stopped \
-e TZ=UTC \
-v /var/run/docker.sock:/var/run/docker.sock:ro \
-v "$PWD/config.yml:/etc/kestrelynx/config.yml:ro" \
-v kestrelynx-state:/var/lib/kestrelynx \
ghcr.io/kitsunetrail/kestrelynx:latest
docker logs -f kestrelynx
- The
kestrelynx-statevolume preserves scan history and the intel feed cache, so do not delete this volume.
Run with Docker Compose
Start KestreLynx in the directory containing the config.yml file created in Prepare the configuration.
- The
kestrelynx-statevolume preserves scan history and the intel feed cache, so do not delete this volume.
Run on Kubernetes
You can deploy inside the cluster or connect from outside the cluster. Choose the instructions that suit your environment.
- One instance covers one cluster.
- Trivy fetches images from the registry, so KestreLynx needs registry access from wherever it runs.
Run inside the cluster
-
Download the repository or clone it with the following commands.
-
Edit
deploy/kubernetes/configmap.yaml.-
Configure at least one notification destination.
-
To scan only specific namespaces, list them in
kubernetes.namespaces(the default is all namespaces). - If multiple instances post to one Slack channel, set
environment.nameto a name that distinguishes the instance. - See Configuration for other settings.
-
-
Edit the storage settings in
deploy/kubernetes/pvc.yamlto suit your cluster.- The default is 1 GiB with
ReadWriteOnceaccess. - This PVC preserves scan history, first-seen dates, and the intel feed cache, so these persist after Pod recreation.
- The default is 1 GiB with
-
Run the following command to create the namespace.
-
Follow Authenticate to private registries only if you scan images from private registries.
-
Run the following commands to apply the manifests, wait for KestreLynx to start, and then check the logs.
kubectl apply -f deploy/kubernetes/ kubectl rollout status -n kestrelynx deployment/kestrelynx kubectl logs -n kestrelynx deployment/kestrelynx -f- This creates a ServiceAccount, a read-only ClusterRole and its ClusterRoleBinding, a ConfigMap, a PVC, and a Deployment.
- This command does not apply
work/, so apply it separately following Work Pod configuration only if you use language-package updates.
Do not run two copies
Do not change the replica count of 1 or the Recreate strategy in deployment.yaml, and do not share one state volume between two instances.
Two Pods writing state data at the same time corrupt the scan history.
Authenticate to private registries inside the cluster
When running outside the cluster, configure registries directly in config.yml, so this procedure is unnecessary.
KestreLynx does not read inside Pods; it fetches the images used by Pods from registries to scan them, so images in private registries require credentials.
It does not reuse Pod imagePullSecrets.
-
Run the following command to create
config.ymlfrom the configuration indeploy/kubernetes/configmap.yaml.- Do not commit this file to the repository because it contains passwords.
-
Add
registriesto theconfig.ymlyou created in step 1.- See Image registry authentication for each key, including
token_hosts. - For Docker Hub, specify
host: docker.ioandtoken_hosts: [auth.docker.io].
- See Image registry authentication for each key, including
-
Create a Secret from the
config.ymlyou created in step 1. -
Change the
configvolume indeploy/kubernetes/deployment.yamlto use the Secret.
If credentials are missing or incorrect, the image appears in notifications as a scan failure.
After moving the configuration to a Secret, use the following commands to apply configuration changes, including when other pages instruct you to apply a ConfigMap.
kubectl create secret generic kestrelynx-config \
--namespace kestrelynx \
--from-file=config.yml=config.yml \
--dry-run=client -o yaml | kubectl apply -f -
kubectl rollout restart -n kestrelynx deployment/kestrelynx
Run outside the cluster
Run KestreLynx on a Docker host outside the cluster and connect to the API server to scan the cluster. Language-package updates using work Pods have not been verified in this setup. For details, see Connecting from outside the cluster on the configuration page.
-
Follow Prepare the configuration to clone the repository and create
config.yml. -
Run the following commands to create the namespace and a ServiceAccount with read-only permissions.
-
Run the following commands to create a non-expiring ServiceAccount token as a Secret and wait for the token to be created.
-
Run the following commands in the directory containing
config.ymlto save the token and the cluster CA certificate to files.kubectl get secret -n kestrelynx kestrelynx-token -o jsonpath='{.data.token}' | base64 -d > token kubectl get secret -n kestrelynx kestrelynx-token -o jsonpath='{.data.ca\.crt}' | base64 -d > ca.crt chmod 600 token- Do not commit
tokento the repository because it contains credentials that grant read access to the cluster.
- Do not commit
-
Edit
config.ymlto enable the commented-outkubernetessection with the following contents.kubernetes: enabled: true api_server: "https://kubernetes.example.com:6443" token_file: /etc/kestrelynx/token ca_file: /etc/kestrelynx/ca.crt-
Set
api_serverto an API server URL reachable from the KestreLynx container and use the following command to check the URL used bykubectl(note that127.0.0.1inside the container does not refer to the Docker host). -
If the URL's hostname or address is not included in the API server certificate, set
tls_server_namefollowing Connecting from outside the cluster. - To scan images from private registries, add
registriesto the sameconfig.ymlfollowing Image registry authentication.
-
-
Run the following commands to start KestreLynx and check the logs.
docker run -d --name kestrelynx \ --restart unless-stopped \ -e TZ=UTC \ -v "$PWD/config.yml:/etc/kestrelynx/config.yml:ro" \ -v "$PWD/token:/etc/kestrelynx/token:ro" \ -v "$PWD/ca.crt:/etc/kestrelynx/ca.crt:ro" \ -v kestrelynx-state:/var/lib/kestrelynx \ ghcr.io/kitsunetrail/kestrelynx:latest docker logs -f kestrelynx- The
kestrelynx-statevolume preserves scan history and the intel feed cache, so do not delete this volume.
- The
Remediation plans and pull requests
See the remediation overview for an overview of the feature on Docker and Kubernetes.
| Action | Instructions |
|---|---|
| Enable update candidate planning | Enabling remediation plans |
| Enable GitHub PR creation | Enabling fix pull requests |
Set the timezone
schedule.daily_at is interpreted in the timezone specified by TZ, which defaults to UTC.
- When running with Docker or outside a Kubernetes cluster, change
-e TZ=UTCin thedocker runcommand in the corresponding instructions. - When running with Docker Compose, change
TZ=UTCindocker-compose.yml. - When running inside a Kubernetes cluster, change the
TZenvironment variable indeploy/kubernetes/deployment.yaml.
For example, specify TZ=Asia/Tokyo to use Japan Standard Time.
Reference pages
- Configuration — configuration options and defaults
- Scan notification conditions — delivery conditions for each notification mode