{"record":{"id":"38249adb45cba6c5","repo":"quarkusio/quarkus","slug":"knative-was-requested-as-a-deployment-but-the-tar","errorCode":null,"errorMessage":"Knative was requested as a deployment, but the target cluster is not a Knative cluster!","messagePattern":"Knative was requested as a deployment, but the target cluster is not a Knative cluster!","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/KnativeDeployer.java","lineNumber":31,"sourceCode":"import io.quarkus.kubernetes.spi.KubernetesDeploymentClusterBuildItem;\n\npublic class KnativeDeployer {\n\n    @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(KNATIVE)) {\n                try (KnativeClient client = kubernetesClientBuilder.buildClient().adapt(KnativeClient.class)) {\n                    if (client.hasApiGroup(\"knative.dev\", false)) {\n                        deploymentCluster.produce(new KubernetesDeploymentClusterBuildItem(KNATIVE));\n                    } else {\n                        throw new IllegalStateException(\n                                \"Knative was requested as a deployment, but the target cluster is not a Knative cluster!\");\n                    }\n                }\n            }\n        });\n    }\n}\n","sourceCodeStart":13,"sourceCodeEnd":39,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/KnativeDeployer.java#L13-L39","documentation":"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.","triggerScenarios":"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).","commonSituations":"Pointed kubectl context at a plain Kubernetes/minikube/Kind cluster without Knative Serving installed; wrong kubeconfig context selected; Knative CRDs not installed yet.","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)"],"exampleFix":"// before\nquarkus.knative.deploy=true  # against plain k8s\n// after\nkubectl apply -f knative-serving.yaml  # or use quarkus.kubernetes.deploy=true","handlingStrategy":"validation","validationCode":"kubectl api-versions | grep knative.dev || echo \"Knative NOT installed on current context\"\nkubectl config current-context","typeGuard":null,"tryCatchPattern":"try { deployKnative(); } catch (IllegalStateException e) {\n    if (e.getMessage().contains(\"not a Knative cluster\")) {\n        LOG.error(\"Target cluster lacks knative.dev API group — install Knative Serving or switch context\");\n    }\n    throw e;\n}","preventionTips":["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"],"tags":["kubernetes","knative","cluster","environment-check"],"backgroundTag":"knative-api-group-missing","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}