{"record":{"id":"bc012d7c183fb0e5","repo":"k3s-io/k3s","slug":"all-cloud-provider-functionality-disabled-by-confi","errorCode":null,"errorMessage":"all cloud-provider functionality disabled by config","messagePattern":"all cloud-provider functionality disabled by config","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/cloudprovider/cloudprovider.go","lineNumber":78,"sourceCode":"\t\t\tConfig: Config{\n\t\t\t\tLBDefaultPriorityClassName: DefaultLBPriorityClassName,\n\t\t\t\tLBEnabled:                  true,\n\t\t\t\tLBImage:                    DefaultLBImage,\n\t\t\t\tLBNamespace:                DefaultLBNS,\n\t\t\t\tNodeEnabled:                true,\n\t\t\t},\n\t\t}\n\n\t\tif config != nil {\n\t\t\tvar bytes []byte\n\t\t\tbytes, err = io.ReadAll(config)\n\t\t\tif err == nil {\n\t\t\t\terr = json.Unmarshal(bytes, &k.Config)\n\t\t\t}\n\t\t}\n\n\t\tif !k.LBEnabled && !k.NodeEnabled {\n\t\t\treturn nil, errors.New(\"all cloud-provider functionality disabled by config\")\n\t\t}\n\n\t\treturn &k, err\n\t})\n}\n\nfunc (k *k3s) Initialize(clientBuilder cloudprovider.ControllerClientBuilder, stop <-chan struct{}) {\n\tctx := logger.NewContext(wait.ContextForChannel(stop), controllerName)\n\tconfig := clientBuilder.ConfigOrDie(controllerName)\n\tk.client = kubernetes.NewForConfigOrDie(config)\n\n\tif k.LBEnabled {\n\t\t// Wrangler controller and caches are only needed if the load balancer controller is enabled.\n\t\tk.recorder = util.BuildControllerEventRecorder(ctx, k.client, controllerName, meta.NamespaceAll)\n\t\tcoreFactory := core.NewFactoryFromConfigOrDie(config)\n\t\tk.nodeCache = coreFactory.Core().V1().Node().Cache()\n\n\t\tlbCoreFactory := core.NewFactoryFromConfigWithOptionsOrDie(config, &generic.FactoryOptions{Namespace: k.LBNamespace})","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/k3s-io/k3s/blob/6ba341e396edc16b8dcae978a7c5e3ac7ee5606e/pkg/cloudprovider/cloudprovider.go#L60-L96","documentation":"The k3s cloud provider registers under the name 'k3s' with lbEnabled and nodeEnabled defaulting to true. If the JSON cloud-config supplied to the controller-manager sets both to false, the provider has nothing to run and registration returns an error instead of a silent no-op provider.","triggerScenarios":"Starting kube-controller-manager / k3s's embedded cloud controller with `--cloud-provider=k3s --cloud-config=<file>` where the file is `{\"lbEnabled\":false,\"nodeEnabled\":false}`.","commonSituations":"Operators trying to switch off ServiceLB and the node controller via cloud-config while still loading the k3s provider; config files copied from docs with both toggles flipped; leftover cloud-config when migrating to a different CCM.","solutions":["If neither function is wanted, do not load the k3s cloud provider at all — drop --cloud-provider=k3s / the cloud-config file","Keep at least one of lbEnabled/nodeEnabled true in the JSON config","To disable only ServiceLB, use the k3s flag --disable-service-lb rather than blanking cloud-config"],"exampleFix":"# before (cloud-config.json)\n{\"lbEnabled\":false,\"nodeEnabled\":false}\n\n# after (ServiceLB off, node controller still active)\n{\"lbEnabled\":false,\"nodeEnabled\":true}","handlingStrategy":"validation","validationCode":"// validate cloud-config before handing it to the controller-manager\ntype k3sCCMConfig struct {\n    LBEnabled   *bool `json:\"lbEnabled\"`\n    NodeEnabled *bool `json:\"nodeEnabled\"`\n}\nvar c k3sCCMConfig\nif err := json.Unmarshal(raw, &c); err == nil {\n    lb := c.LBEnabled == nil || *c.LBEnabled\n    node := c.NodeEnabled == nil || *c.NodeEnabled\n    if !lb && !node {\n        return errors.New(\"cloud-config disables all k3s provider functionality; omit --cloud-provider=k3s instead\")\n    }\n}","typeGuard":"func k3sProviderConfigUsable(cfg []byte) bool {\n    var c struct {\n        LBEnabled   *bool `json:\"lbEnabled\"`\n        NodeEnabled *bool `json:\"nodeEnabled\"`\n    }\n    if json.Unmarshal(cfg, &c) != nil {\n        return true // parse error handled elsewhere\n    }\n    lb := c.LBEnabled == nil || *c.LBEnabled\n    node := c.NodeEnabled == nil || *c.NodeEnabled\n    return lb || node\n}","tryCatchPattern":null,"preventionTips":["Don't load the k3s cloud provider when both controllers are unwanted","Prefer k3s CLI flags (--disable-service-lb) over cloud-config toggles for disabling features","Schema-validate cloud-config JSON in CI"],"tags":["cloud-provider","servicelb","configuration","validation"],"backgroundTag":null,"analyzedSha":"6ba341e396edc16b8dcae978a7c5e3ac7ee5606e","analyzedAt":"2026-08-15T16:27:54.286Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}