quarkusio/quarkus · error · IllegalStateException
Knative was requested as a deployment, but the target cluste
Error message
Knative was requested as a deployment, but the target cluster is not a Knative cluster!
What it means
KnativeDeployer.checkEnvironment verifies that, when the Knative deployment target was selected, the target cluster actually exposes the knative.dev API group. If the cluster is plain Kubernetes without Knative (Serving) installed, it throws IllegalStateException instead of producing a KubernetesDeploymentClusterBuildItem.
Source
Thrown at extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/KnativeDeployer.java:31
import io.quarkus.kubernetes.spi.KubernetesDeploymentClusterBuildItem;
public class KnativeDeployer {
@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(KNATIVE)) {
try (KnativeClient client = kubernetesClientBuilder.buildClient().adapt(KnativeClient.class)) {
if (client.hasApiGroup("knative.dev", false)) {
deploymentCluster.produce(new KubernetesDeploymentClusterBuildItem(KNATIVE));
} else {
throw new IllegalStateException(
"Knative was requested as a deployment, but the target cluster is not a Knative cluster!");
}
}
}
});
}
}
View on GitHub (pinned to e1c734241f)
Solutions
- Install Knative Serving on the target cluster (kn quickstart or the official Knative install)
- Switch to the correct kube context that points to a Knative cluster (kubectl config use-context ...) before building/deploying
- If you don't want Knative, deploy with the plain kubernetes target instead (quarkus.kubernetes.deploy=true)
Example fix
// before quarkus.knative.deploy=true # against plain k8s // after kubectl apply -f knative-serving.yaml # or use quarkus.kubernetes.deploy=true
Defensive patterns
Strategy: validation
Validate before calling
kubectl api-versions | grep knative.dev || echo "Knative NOT installed on current context" kubectl config current-context
Try / catch
try { deployKnative(); } catch (IllegalStateException e) {
if (e.getMessage().contains("not a Knative cluster")) {
LOG.error("Target cluster lacks knative.dev API group — install Knative Serving or switch context");
}
throw e;
} Prevention
- Verify kubectl context points to a Knative-enabled cluster before knative deploys
- Install Knative Serving (with serving CRDs) in dev/test clusters
- Fall back to the plain kubernetes target when Knative is not available
When it happens
Trigger: Building with quarkus.knativive.deploy=true (Knative target selected) while the cluster reachable via the current kubeconfig lacks the knative.dev API group, as probed by KnativeClient.hasApiGroup("knative.dev", false).
Common situations: Pointed kubectl context at a plain Kubernetes/minikube/Kind cluster without Knative Serving installed; wrong kubeconfig context selected; Knative CRDs not installed yet.
Related errors
- Build:%s is no longer present!
- Build:%s has no status!
- Build:%s encountered error! %s
- Build:%s cancelled!
- Build:%s failed! %s
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/38249adb45cba6c5.
Report an issue: GitHub.