quarkusio/quarkus · error · RuntimeException
Unable to setup environment for generating Kubernetes…
Error message
Unable to setup environment for generating Kubernetes resources
What it means
During the Kubernetes resource generation build step, Quarkus creates a temporary working directory (Files.createTempDirectory) to hold generated manifests. If the filesystem cannot provide a temp directory (IOException), the build aborts with this RuntimeException.
Solutions
- Free disk space on the volume backing the temp directory.
- Ensure /tmp (or java.io.tmpdir) exists and is writable by the build user (e.g. add a writable emptyDir tmp mount in the build container).
- Set -Djava.io.tmpdir=/some/writable/dir for the Maven/Gradle build process.
Example fix
// before MAVEN_OPTS="-Xmx4g" ./mvnw package // /tmp full or read-only // after mkdir -p /workspace/tmp && MAVEN_OPTS="-Xmx4g -Djava.io.tmpdir=/workspace/tmp" ./mvnw package
Defensive patterns
Strategy: validation
Validate before calling
// Check temp dir writability before building
Path tmp = Path.of(System.getProperty("java.io.tmpdir"));
if (!Files.isDirectory(tmp) || !Files.isWritable(tmp)) {
throw new IllegalStateException("Temp dir not writable: " + tmp + " — set -Djava.io.tmpdir");
}
Files.createTempFile("quarkus-preflight", ".tmp"); // probe write Try / catch
try {
./mvnw package
} — outside Java: preflight the build container:
if [ ! -w "${TMPDIR:-/tmp}" ]; then export JAVA_TOOL_OPTIONS="$JAVA_TOOL_OPTIONS -Djava.io.tmpdir=/workspace/tmp"; fi Prevention
- Give build containers a writable tmp volume (emptyDir mount at /tmp).
- Monitor disk space on CI runners.
- Set an explicit writable -Djava.io.tmpdir in build images.
When it happens
Trigger: Files.createTempDirectory("quarkus-kubernetes") throws IOException during the kubernetes build step — e.g. the java.io.tmpdir is read-only, full, or missing.
Common situations: Disk-full CI runners or containers with read-only /tmp; restrictive TMPDIR/java.io.tmpdir permissions; containers running with a read-only root filesystem and no writable tmp mount.
Related errors
- An error occurred while processing
- Failed to create directory: " + protoOutputDir
- Failed to create the output dir
- does not point to the application output directory
- Cannot create directory
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/c6148fbcc8ef8373.
Report an issue: GitHub.
Appendix: source
Thrown at extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/KubernetesProcessor.java:125
List<ConfiguratorBuildItem> configurators,
List<ConfigurationSupplierBuildItem> configurationSuppliers,
List<DecoratorBuildItem> decorators,
BuildProducer<DekorateOutputBuildItem> dekorateSessionProducer,
Optional<CustomProjectRootBuildItem> customProjectRoot,
Optional<CustomKubernetesOutputDirBuildItem> customOutputDir,
BuildProducer<GeneratedFileSystemResourceBuildItem> generatedResourceProducer,
BuildProducer<GeneratedKubernetesResourceBuildItem> generatedKubernetesResourceProducer,
BuildProducer<KubernetesOutputDirectoryBuildItem> outputDirectoryBuildItemBuildProducer) {
List<ConfiguratorBuildItem> allConfigurators = new ArrayList<>(configurators);
List<ConfigurationSupplierBuildItem> allConfigurationSuppliers = new ArrayList<>(configurationSuppliers);
List<DecoratorBuildItem> allDecorators = new ArrayList<>(decorators);
final Path root;
try {
root = Files.createTempDirectory("quarkus-kubernetes");
} catch (IOException e) {
throw new RuntimeException("Unable to setup environment for generating Kubernetes resources", e);
}
Map<String, Object> config = KubernetesConfigUtil.toMap(kubernetesConfig, openshiftConfig, knativeConfig);
Set<String> deploymentTargets = kubernetesDeploymentTargets.getEntriesSortedByPriority().stream()
.map(DeploymentTargetEntry::getName)
.collect(Collectors.toSet());
Path artifactPath = getRunner(outputTarget, packageConfig);
try {
// by passing false to SimpleFileWriter, we ensure that no files are actually written during this phase
Optional<Project> optionalProject = KubernetesCommonHelper.createProject(applicationInfo, customProjectRoot,
artifactPath);
optionalProject.ifPresent(project -> {
Set<String> targets = new HashSet<>();
targets.add(COMMON);
targets.addAll(deploymentTargets);
final Map<String, String> generatedResourcesMap;View on GitHub (pinned to e1c734241f)