liveBook · Manning

Quarkus-kubernetes

As explained in Quarkus in Action

quarkus-kubernetes is a Quarkus extension that generates Kubernetes manifests for deploying applications.

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

How Quarkus in Action covers it

How deep it goes
Explains extension setup, generated files, resource defaults, customization, manifest merging, and application, but not cluster setup.
Examples
Uses an Inventory service with HTTP and gRPC ports, a MySQL dependency, generated YAML, kubectl apply, pod inspection, and port forwarding.
What it assumes
Assumes a Quarkus application and build workflow; does not teach Kubernetes cluster setup or kubectl installation.
What you can do after
Apply via Quarkus and kubectl generated manifests, then inspect pods and customize deployment resources through configuration.
How it connects
Connects Kubernetes manifests with Dekorate, Deployments, Services, ServiceMonitor, container images, and kubectl.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Quarkus in Action. The section links point to the parts of the book it draws on.