How do I enrich Kubernetes Resources created by Kubernetes-Maven-Plugin using Kustomize?

30 views Asked by At

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

1

There are 1 answers

0
Dion V On

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:

  1. 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).

  2. Configure the Maven Plugin for Kustomize:

    Set the buildDirectory property to the root of your Kustomize project.

  3. 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.

  4. 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.

  5. Handle Kustomize Dependencies

    Install Kustomize locally or as a Maven plugin to ensure availability.

  6. Automate Deployment

    Integrate with Maven build lifecycle phases for automated deployment