{"record":{"id":"ade4c25e78978a4a","repo":"quarkusio/quarkus","slug":"failed-to-configure-openshift-make-sure-you-have","errorCode":null,"errorMessage":"Failed to configure OpenShift. Make sure you have the Quarkus OpenShift extension.","messagePattern":"Failed to configure OpenShift\\. Make sure you have the Quarkus OpenShift extension\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/OpenshiftDeployer.java","lineNumber":36,"sourceCode":"    @BuildStep\n    public void checkEnvironment(Optional<SelectedKubernetesDeploymentTargetBuildItem> selectedDeploymentTarget,\n            List<GeneratedKubernetesResourceBuildItem> resources,\n            KubernetesClientBuildItem kubernetesClientBuilder,\n            BuildProducer<KubernetesDeploymentClusterBuildItem> deploymentCluster) {\n        selectedDeploymentTarget.ifPresent(target -> {\n            if (!KubernetesDeploy.INSTANCE.checkSilently(kubernetesClientBuilder)) {\n                return;\n            }\n            if (target.getEntry().getName().equals(OPENSHIFT)) {\n                try (var openShiftClient = kubernetesClientBuilder.buildClient().adapt(OpenShiftClient.class)) {\n                    if (openShiftClient.hasApiGroup(\"openshift.io\", false)) {\n                        deploymentCluster.produce(new KubernetesDeploymentClusterBuildItem(OPENSHIFT));\n                    } else {\n                        throw new IllegalStateException(\n                                \"Openshift was requested as a deployment, but the target cluster is not an Openshift cluster!\");\n                    }\n                } catch (Exception e) {\n                    throw new RuntimeException(\n                            \"Failed to configure OpenShift. Make sure you have the Quarkus OpenShift extension.\", e);\n                }\n            }\n        });\n    }\n}\n","sourceCodeStart":18,"sourceCodeEnd":43,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/OpenshiftDeployer.java#L18-L43","documentation":"The OpenshiftDeployer tries to build a Kubernetes client and adapt it to an OpenShiftClient to check the cluster. Any exception while creating/configuring that client (connection failure, missing extension classes, bad kubeconfig) is wrapped in this RuntimeException, which advises that the Quarkus OpenShift extension may be missing.","triggerScenarios":"An exception (any Exception) is thrown while building the client or calling hasApiGroup in checkEnvironment — e.g. unreachable cluster, invalid kubeconfig, or the kubernetes-client OpenShift capability not present because the quarkus-openshift extension is not installed.","commonSituations":"Using quarkus.kubernetes-client without the quarkus-openshift extension while deploying to OpenShift; cluster unreachable/wrong context in CI; malformed KUBECONFIG file.","solutions":["Add the Quarkus OpenShift extension: ./mvnw quarkus:add-extension -Dextensions=quarkus-openshift (or add io.quarkus:quarkus-openshift dependency).","Fix cluster connectivity: verify 'kubectl cluster-info' / 'oc whoami' with the same KUBECONFIG used by the build.","Correct or regenerate the kubeconfig file referenced by your environment/config."],"exampleFix":"// before (pom.xml)\n<!-- only quarkus-kubernetes present -->\n// after\n<dependency>\n  <groupId>io.quarkus</groupId>\n  <artifactId>quarkus-openshift</artifactId>\n</dependency>","handlingStrategy":"validation","validationCode":"// Ensure the OpenShift client capability is present and the cluster is reachable before deploying\nClass.forName(\"io.fabric8.openshift.client.OpenShiftClient\"); // throws if extension/client missing\ntry (var c = new KubernetesClientBuilder().build().adapt(OpenShiftClient.class)) {\n    c.getConfiguration(); // forces connection setup; surfaces config errors early\n}","typeGuard":null,"tryCatchPattern":"try {\n    deploy();\n} catch (RuntimeException e) {\n    if (e.getMessage().startsWith(\"Failed to configure OpenShift\")) {\n        LOGGER.error(\"Install quarkus-openshift or fix cluster connectivity\", e);\n        throw new BuildFailure(\"OpenShift deploy prerequisite missing\", e);\n    }\n    throw e;\n}","preventionTips":["Add io.quarkus:quarkus-openshift whenever quarkus.openshift.* config is used.","Validate 'oc whoami' / 'kubectl cluster-info' in the CI environment before builds.","Keep KUBECONFIG valid and current in build containers."],"tags":["kubernetes","openshift","client-setup","missing-extension"],"backgroundTag":"openshift-client-init-failed","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}