We are using the Kubernetes-Maven-Plugin but we often face limitations. We also use kustomize, but don`t know how to properly let those two work together. Are there any best practices known?
We expect a smooth integration where the plugin can also use additional resources to update the k8s resources to be applied
This may help with your concern but here are some practices that you can try when integrating Kubernetes Maven plugin and Kustomize for a smooth workflow:
Separate kustomize baseline and patches
Create a
base
directory for your core Kubernetes manifests.Use
overlays
directories for environment-specific patches (e.g.,dev
,staging
,prod
).Configure the Maven Plugin for Kustomize:
Set the
buildDirectory
property to the root of your Kustomize project.Choose a Kustomize Generation Strategy
build
goal: Generates manifests and applies them directly.resource
goal: Generates manifests as a resource within the Maven build, allowing further processing or packaging.Leverage Maven for Additional Resources
Use Maven's resource filtering and processing capabilities to generate supplementary files for Kustomize (e.g., config maps, secrets).
Place these files in appropriate directories within your Kustomize project.
Handle Kustomize Dependencies
Install Kustomize locally or as a Maven plugin to ensure availability.
Automate Deployment
Integrate with Maven build lifecycle phases for automated deployment