quarkusio/quarkus · error · IllegalStateException
Openshift was requested as a deployment, but the target clus
Error message
Openshift was requested as a deployment, but the target cluster is not an Openshift cluster!
What it means
When OpenShift is listed as a deployment target, the deployer connects to the configured cluster and probes for the openshift.io API group to verify it is actually an OpenShift cluster. If the API group is absent, the target cluster is plain Kubernetes, and OpenShift-specific DeploymentConfigs cannot be applied, so the build fails with this IllegalStateException.
Source
Thrown at extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/OpenshiftDeployer.java:32
import io.quarkus.kubernetes.spi.KubernetesDeploymentClusterBuildItem;
public class OpenshiftDeployer {
@BuildStep
public void checkEnvironment(Optional<SelectedKubernetesDeploymentTargetBuildItem> selectedDeploymentTarget,
List<GeneratedKubernetesResourceBuildItem> resources,
KubernetesClientBuildItem kubernetesClientBuilder,
BuildProducer<KubernetesDeploymentClusterBuildItem> deploymentCluster) {
selectedDeploymentTarget.ifPresent(target -> {
if (!KubernetesDeploy.INSTANCE.checkSilently(kubernetesClientBuilder)) {
return;
}
if (target.getEntry().getName().equals(OPENSHIFT)) {
try (var openShiftClient = kubernetesClientBuilder.buildClient().adapt(OpenShiftClient.class)) {
if (openShiftClient.hasApiGroup("openshift.io", false)) {
deploymentCluster.produce(new KubernetesDeploymentClusterBuildItem(OPENSHIFT));
} else {
throw new IllegalStateException(
"Openshift was requested as a deployment, but the target cluster is not an Openshift cluster!");
}
} catch (Exception e) {
throw new RuntimeException(
"Failed to configure OpenShift. Make sure you have the Quarkus OpenShift extension.", e);
}
}
});
}
}
View on GitHub (pinned to e1c734241f)
Solutions
- Point kubectl/client config at a real OpenShift cluster (oc login / correct KUBECONFIG context).
- Switch the deployment target to kubernetes: quarkus.kubernetes.deployment-target=kubernetes if the cluster is vanilla Kubernetes.
- Verify the cluster with 'kubectl get --raw /.well-known/openid-configuration' or check API groups; ensure the right context with 'kubectl config current-context'.
Example fix
// before (target is plain Kubernetes) quarkus.kubernetes.deployment-target=openshift // after quarkus.kubernetes.deployment-target=kubernetes
Defensive patterns
Strategy: validation
Validate before calling
// Probe the cluster's API groups before choosing the openshift deployment target
boolean isOpenShift = client.getApiGroups().getGroups().stream()
.anyMatch(g -> g.getName().equals("openshift.io"));
if (!isOpenShift) {
System.setProperty("quarkus.kubernetes.deployment-target", "kubernetes");
} Try / catch
try {
deploy();
} catch (IllegalStateException e) {
if (e.getMessage().contains("target cluster is not an Openshift cluster")) {
// fall back to vanilla kubernetes target
System.setProperty("quarkus.kubernetes.deployment-target", "kubernetes");
deploy();
} else { throw e; }
} Prevention
- Verify the cluster type (oc whoami / API group check) in CI before deploying.
- Use separate config profiles per cluster type: %prod-k8s vs %prod-openshift.
- Never point quarkus.openshift.* config at non-OpenShift clusters.
When it happens
Trigger: quarkus.openshift.deploy=true (or openshift in quarkus.kubernetes.deployment-target) against a cluster that does not expose the openshift.io API group.
Common situations: Pointing quarkus.openshift.* config at a vanilla Kubernetes cluster (minikube, kind, EKS/GKE/AKS); KUBECONFIG/context pointing to the wrong cluster in CI.
Related errors
- Build:%s is no longer present!
- Build:%s has no status!
- Build:%s cancelled!
- Build:%s failed! %s
- Build:%s encountered error! %s
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/936067e07d8d925f.
Report an issue: GitHub.