quarkus-kubernetes is a Quarkus extension that generates complete Kubernetes manifests, avoiding tedious and error-prone handwritten YAML. It uses Dekorate and can produce resources ready to apply to a cluster. section 11.3.1
Add the extension to an application, then build it. The build writes kubernetes.yml and kubernetes.json under target/kubernetes. Defaults can generate a Service, Deployment, and ServiceMonitor, while detected application settings can propagate into ports and image configuration. section 11.3.3
Generate and apply an Inventory service
Run quarkus ext add kubernetes in the service project, build with quarkus build, and apply target/kubernetes/kubernetes.yml using kubectl apply -f. The generated Deployment can reference the application image, while the Service exposes HTTP and gRPC ports. kubectl get pods verifies running workloads, and kubectl port-forward can expose the service locally. section 11.3.3
Customize generated resources with quarkus.kubernetes properties for deployment kind, replicas, namespace, labels, annotations, environment variables, and volume mounts. These properties are processed during image and manifest construction, so changing them at deployment time does not alter generated resources. section 11.3.2
# The application resource type quarkus.kubernetes.deployment-kind=Deployment|StatefulSet|Job|CronJob # The number of replicas quarkus.kubernetes.replicas=5 # The namespace for the resources quarkus.kubernetes.namespace=custom-namespace # Annotations to add to the resources quarkus.kubernetes.annotations.ANNOTATION_KEY=annotation-value # Labels to add to the resources quarkus.kubernetes.labels.LABEL_KEY=label-value # Environment variables, env-var-key translates to ENV_VAR_KEY variable quarkus.kubernetes.env.vars.ENV_VAR_KEY=env-var-value # Volume mounts quarkus.kubernetes.mounts.MOUNT_KEY.name=name-of-the-volume-to-mount quarkus.kubernetes.mounts.MOUNT_KEY.path=/path/where/to/mount
Use the configuration listing to review common resource customizations, including replicas, namespace, metadata, environment variables, and volume mounts. section 11.3.2
Existing kubernetes.yml, openshift.yml, knative.yml, or JSON manifests placed in src/main/kubernetes are combined with generated resources. This supports application-specific dependencies such as a database. section 11.3.2
