Enabling remediation
Enabling remediation plans and pull requests on Kubernetes
Use this procedure to check remediation plans and then enable remediation pull requests in KestreLynx running on Kubernetes. Complete the shared preparation first (GitHub access, source mappings, and private image authentication if needed), then configure plans, verify startup, configure pull requests, and enable and apply PR creation.
See Terms for the terminology used on this page.
Configure remediation plans
Choose what remediation plans will examine.
-
Merge the following minimal configuration into the
config.ymlentry underdataindeploy/kubernetes/configmap.yamlTo examine candidates only for published images, you can start with this configuration alone. If you store configuration in a Secret, edit the
config.ymlused to create that Secret. -
Add mappings to also examine language packages or base images
This example specifies language packages and a base image in the
config.ymlentry underdataindeploy/kubernetes/configmap.yaml(orconfig.ymlfor a Secret).remediation: mappings: - workload: deployment/example/web/app repository: example/application base_branch: main dependencies: directory: . dockerfile: path: docker/DockerfileOmit
dependenciesordockerfileif you do not want to examine that target. See Mapping the source for choosing keys and preparing dependency directories.
Use the workload key shown in notifications for workload.
In deployment/example/web/app, deployment is the kind, example is the namespace, web is the workload name, and app is the container name.
See Kubernetes mappings for key constraints and Basic settings for enablement settings.
Remediation plans additionally LIST deployments, statefulsets, daemonsets, and cronjobs, but the provided read-only ClusterRole needs no additional permissions.
Verify remediation plan startup
Apply the edited configuration and verify that remediation plans run.
-
From the repository root, apply the ConfigMap and restart the KestreLynx Pod
For a Secret, replace the first command that applies the ConfigMap with the Secret update procedure in Authenticate to private registries inside the cluster.
-
Run the following command to check configuration loading and remediation plan results
Check the following log messages and values to verify enablement and plan creation.
What to verify Log message Values to check Remediation plans enabled fix plan enabledpull_requests=falsePlan created fix plan builtItem counts: items,dependency_units, anddockerfile_itemsUpdate candidate counts fix plan builtupdate_candidate,dependency_update_candidates, anddockerfile_update_candidatesZero plan items or update candidates do not mean that enablement failed.
At the scan after startup or the next scheduled scan, check that the notification shows the intended workloads, sources, and update targets. See Displayed fields for display meanings, or Check for missing plans if no plan appears.
Configure remediation pull requests
Specify the files that remediation pull requests will update. Complete remediation plan startup verification, then follow these steps.
- Configure mappings for what you want to update using the sections on this page
- For npm, pnpm, pip, uv, Go, Gradle, or Rust package updates, follow Preparing work Pods through configuring the work namespace and mappings, then return to this page (not needed for Maven alone)
- Enable and apply PR creation, then verify startup and processing results
Use the update target to choose the configuration key and procedure.
| What to update | Configuration key | Procedure |
|---|---|---|
| Manifest image tags | manifest |
Configure PRs for manifests and Dockerfiles |
| Kustomize image tags | kustomize |
Configure Kustomize PRs |
| Image tags in Helm values | helm_values |
Configure Helm values PRs |
| Dockerfile base images | dockerfile |
Configure PRs for manifests and Dockerfiles |
| Language packages | dependencies |
Mapping the source and Preparing work Pods |
Specify only one of manifest, kustomize, and helm_values for a container's image tag.
Configure PRs for manifests and Dockerfiles
Specify where to update manifest image tags and Dockerfile base images.
Edit remediation.mappings in the config.yml entry under data in deploy/kubernetes/configmap.yaml (or config.yml for a Secret).
This example updates the tag for web/app in apps/web.yaml and the base image for api/app in docker/Dockerfile.
remediation:
mappings:
- workload: deployment/example/web/app
repository: example/deployment
base_branch: main
manifest:
path: apps/web.yaml
- workload: deployment/example/api/app
repository: example/application
base_branch: main
dockerfile:
path: docker/Dockerfile
target: runtime
The runtime in target: runtime is the stage name assigned by FROM ... AS runtime in docker/Dockerfile.
Replace it with the stage name used to build the target image, or omit target when using the last stage.
See Manifest formats for editable formats and Kubernetes manifest PRs for PR creation conditions.
Configure Kustomize PRs
Specify where to update tags managed by Kustomize images and which containers a tag change affects.
Replace any existing manifest or helm_values setting with kustomize.
-
Check the
imagesentry to update inapps/kustomization.yamlin the target repositoryThis example file manages the tag for
nginx. -
Edit
remediation.mappingsin theconfig.ymlentry underdataindeploy/kubernetes/configmap.yaml(orconfig.ymlfor a Secret)In this example, the
appcontainers inwebandworker, and the regular init containerprepareinweb, use the sameimagesentry.remediation: mappings: - workload: deployment/example/web/app repository: example/deployment base_branch: main kustomize: path: apps/kustomization.yaml image: nginx affects: - deployment/example/worker/app - deployment/example/web/prepareFor a regular init container, the Pod status must show that its image reference and content match those of a listed running container in the same Pod. The scan result for that running container is also required.
For detailed checks when these conditions cannot be verified, see Checking for a missing PR.
Set
imagetoimages[].name. Forworkload, choose any one container whose tag is set by thatimagesentry.List every other container in
affects, including regular init containers. The containers in the example are listed as follows.Container Where to specify it deployment/example/web/appworkloaddeployment/example/worker/appkustomize.affectsdeployment/example/web/prepare(regular init container)kustomize.affects -
Verify that
workloadandaffectslist every container affected by the tag change, including regular init containersYou must verify this because KestreLynx does not render Kustomize. Omit
affectsonly if you have verified that the container inworkloadis the only one affected.
See Kubernetes mappings for configuration constraints, Kustomize formats for file formats, and Kustomize PRs for PR creation conditions.
Configure Helm values PRs
Specify where to update tags managed by Helm values and which containers a tag change affects.
Replace any existing manifest or kustomize setting with helm_values.
-
Check the YAML key that specifies the image in
apps/values.yamlin the target repositoryThis example file specifies the image under the
imagekey.Set
helm_values.keyto the path to the key containingrepositoryandtag, rather than totagitself.registryis optional, andkey: imagealso works with a string such asimage: "nginx:1.27.2".If
apps/values.yamluses a nested structure such asapp: {image: "nginx:1.27.2"}, sethelm_values.keytoapp.image. -
Edit
remediation.mappingsin theconfig.ymlentry underdataindeploy/kubernetes/configmap.yaml(orconfig.ymlfor a Secret)In this configuration, the
appcontainers inwebandworker, and the regular init containerprepareinweb, use theimagekey from the first example.remediation: mappings: - workload: deployment/example/web/app repository: example/deployment base_branch: main helm_values: path: apps/values.yaml key: image affects: - deployment/example/worker/app - deployment/example/web/prepareFor a regular init container, the Pod status must show that its image reference and content match those of a listed running container in the same Pod. The scan result for that running container is also required.
For detailed checks when these conditions cannot be verified, see Checking for a missing PR.
For
workload, choose any one container whose tag is set by that values key. List the rest inaffects, including regular init containers.Container Where to specify it deployment/example/web/appworkloaddeployment/example/worker/apphelm_values.affectsdeployment/example/web/prepare(regular init container)helm_values.affects -
Verify that
workloadandaffectslist every container affected by the tag change, including regular init containersOmit
affectsonly if you have verified that the container inworkloadis the only one affected. -
Verify that the specified key provides the final image value and is not overridden by other settings
KestreLynx does not render Helm, so check the following sources of overrides.
- Flux HelmRelease
spec.values - Argo CD
parameters,valuesObject, andvaluesFrom - CI
--setoptions or other values files
- Flux HelmRelease
See Kubernetes mappings for configuration constraints, Helm values formats for file formats, and Helm values PRs for PR creation conditions.
Enable and apply PR creation
Enable PR creation for the configured update targets and apply the settings to KestreLynx.
First review token permissions and common considerations in PR creation prerequisites and cautions.
For the storage location, check remediation.storage_dir in Basic settings.
-
Preserve existing mappings, GitHub tokens, credentials, and storage settings, and merge the following into the
config.ymlentry underdataindeploy/kubernetes/configmap.yaml(orconfig.ymlfor a Secret)Manifest, Dockerfile, Kustomize, and Helm values updates use only the read-only RBAC permissions for scanning.
-
From the repository root, run the same commands as in step 1 of Verify remediation plan startup to apply the ConfigMap and restart the KestreLynx Pod
-
Run the following command to verify that PR creation is enabled and check its results
Check the following log messages and values to verify PR creation enablement and processing results.
What to verify Log message Values to check PR creation enabled fix plan enabledpull_requests=truePR processing results pull request stage finishedcreatedfor the number created andproblemsfor the number of stage-wide problemsIf no PR is created, see Check for missing PRs.