{"record":{"id":"edb430e555fec9fe","repo":"cilium/cilium","slug":"unable-to-retrieve-configmap-q-w-edb430","errorCode":null,"errorMessage":"unable to retrieve ConfigMap %q: %w","messagePattern":"unable to retrieve ConfigMap %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cilium-cli/connectivity/check/features.go","lineNumber":350,"sourceCode":"\t\t}\n\t} else if minVersion, err := ct.DetectMinimumCiliumVersion(ctx); err != nil {\n\t\tdefaultVersion := helm.GetDefaultVersionString()\n\t\tct.Warnf(\"Unable to detect Cilium version, assuming %v for connectivity tests: %s\", defaultVersion, err)\n\t\tct.CiliumVersion, err = semver.ParseTolerant(defaultVersion)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tct.CiliumVersion = *minVersion\n\t}\n\treturn nil\n}\n\nfunc (ct *ConnectivityTest) detectFeatures(ctx context.Context) error {\n\tinitialized := false\n\tcm, err := ct.client.GetConfigMap(ctx, ct.params.CiliumNamespace, defaults.ConfigMapName, metav1.GetOptions{})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to retrieve ConfigMap %q: %w\", defaults.ConfigMapName, err)\n\t}\n\tif cm.Data == nil {\n\t\treturn fmt.Errorf(\"ConfigMap %q does not contain any configuration\", defaults.ConfigMapName)\n\t}\n\n\t// Extract cluster-wide features once outside the loop\n\tclusterFeatures := features.Set{}\n\tclusterFeatures.ExtractFromCiliumVersion(ct.CiliumVersion)\n\tclusterFeatures.ExtractFromConfigMap(cm)\n\tclusterFeatures.ExtractFromNodes(ct.nodesWithoutCilium)\n\tct.extractFeaturesFromK8sCluster(ctx, clusterFeatures)\n\terr = ct.extractFeaturesFromCRDs(ctx, clusterFeatures)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = ct.extractFeaturesFromDNSConfig(ctx, clusterFeatures)\n\tif err != nil {\n\t\treturn err","sourceCodeStart":332,"sourceCodeEnd":368,"githubUrl":"https://github.com/cilium/cilium/blob/ac7b90affa4baf0642e6685319d56907b3a73a6d/cilium-cli/connectivity/check/features.go#L332-L368","documentation":"At the start of feature detection, cilium-cli GETs the cilium-config ConfigMap (defaults.ConfigMapName) in the Cilium namespace. This error wraps any failure of that Get, so detection aborts before any feature is extracted.","triggerScenarios":"ct.client.GetConfigMap(ctx, ct.params.CiliumNamespace, defaults.ConfigMapName, metav1.GetOptions{}) errors: wrong --cilium-namespace, ConfigMap absent, 403 Forbidden, or API server unreachable.","commonSituations":"Cilium installed in a non-default namespace but CLI not told (or default changed); cilium-config deleted/renamed in newer installs (Helm-managed values); RBAC restricting configmap reads; wrong kubeconfig context.","solutions":["Find the correct namespace: kubectl get ns | grep cilium and pass the right namespace to the CLI","Verify the ConfigMap exists: kubectl -n <cilium-ns> get configmap cilium-config","If Cilium was installed purely via Helm, ensure cilium-config is still created or upgrade cilium-cli to match the install method","Fix kubeconfig/RBAC so the client can read configmaps in the Cilium namespace"],"exampleFix":"// before: assuming default namespace\nct := helpers.NewConnectivityTest(..., params) // params.CiliumNamespace left as default\nif err := ct.DetectFeatures(ctx); err != nil { ... }\n// after: resolve namespace before detection\nns, err := helpers.GetCiliumNamespace(ctx, client)\nif err != nil { return err }\nparams.CiliumNamespace = ns\nif err := ct.DetectFeatures(ctx); err != nil { ... }","handlingStrategy":"validation","validationCode":"// pre-flight namespace + configmap check before detectFeatures\nnsOK, _ := client.HasNamespace(ctx, params.CiliumNamespace)\nif !nsOK { return fmt.Errorf(\"cilium namespace %s not found\", params.CiliumNamespace) }\nif _, err := client.GetConfigMap(ctx, params.CiliumNamespace, \"cilium-config\", metav1.GetOptions{}); err != nil {\n\treturn fmt.Errorf(\"cilium-config missing in %s: %w\", params.CiliumNamespace, err)\n}","typeGuard":"func isConfigMapGetError(err error) bool { return err != nil && !apierrors.IsNotFound(err) }","tryCatchPattern":"if err := ct.DetectFeatures(ctx); err != nil {\n\tif strings.Contains(err.Error(), \"unable to retrieve ConfigMap\") {\n\t\tvar se *apierrors.StatusError\n\t\tif errors.As(errors.Unwrap(err), &se) && se.Status().Code == http.StatusNotFound {\n\t\t\tlog.Warnf(\"cilium-config not found in %s; check --cilium-namespace\", ct.params.CiliumNamespace)\n\t\t}\n\t}\n\treturn err\n}","preventionTips":["Always pass the correct Cilium namespace (--cilium-namespace) when not using kube-system","Verify cilium-config exists after install/upgrades","Watch for Helm versions that manage config outside cilium-config","Confirm kubeconfig context before running tests"],"tags":["cilium","kubernetes","configmap","namespace"],"backgroundTag":"k8s-resource-lookup-failed","analyzedSha":"ac7b90affa4baf0642e6685319d56907b3a73a6d","analyzedAt":"2026-08-31T18:27:15.868Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}