Search code examples
kubernetesfabric8kubeconfigfabric8-kubernetes-client

fabric8 Kubernetes Client Config keeps referencing kubeconfig


I am trying to set up a custom Kubernetes Client using the following

Config config = new ConfigBuilder()
        .withMasterUrl(eksEndpoint)
        .withOauthTokenProvider(authTokenProvider)
        .withTrustCerts()
        .build();
return new KubernetesClientBuilder().withConfig(config).build();

This works fine when I do not hacve a kube cionfig file configured. But when I do it tries to reference it and causes this failure.

mapping values are not allowed here
in reader, line 3, column 11:
    "kind": "ExecCredential",

I have gone through as much documentation as I can find but can't see as to why fabric8 keeps referencing my kube config. Removing the kube config is not an option. I have tried adding withAutoConfigure(false) but this has made no difference.


Solution

  • In order to not automatically pick up .kube/config Config.empty() should be provided into the builder constructor:

    Config config = new ConfigBuilder(Config.empty())
            .withMasterUrl(eksEndpoint)
            .withOauthTokenProvider(authTokenProvider)
            .withTrustCerts()
            .build();