Home > Mobile >  Is kubernetes api library targeted for windows OS platform?
Is kubernetes api library targeted for windows OS platform?

Time:08-17

We would like to have GoLang tool(running on windows) that use client-go library(https://github.com/kubernetes/client-go).

Plan is to use this tool instead of kubectl.


Before going for development,

Does client-go library allow the tool to consume kubeconfig from windows machine and talk to kubernetes clusters?

CodePudding user response:

Does client-go library allow the tool to consume kubeconfig from windows machine and talk to kubernetes clusters?

Yes, and you can pass the custom path of the kubeconfig as well.

by default its looking into

KUBE_CONFIG_DEFAULT_LOCATION = os.environ.get('KUBECONFIG', '~/.kube/config')

so you can pass the env export KUBECONFIG=your_custom_path

Here is the function

def load_kube_config(config_file=None, context=None,
                     client_configuration=None,
                     persist_config=True):
    """Loads authentication and cluster information from kube-config file
    and stores them in kubernetes.client.configuration.

    :param config_file: Name of the kube-config file.
    :param context: set the active context. If is set to None, current_context
        from config file will be used.
    :param client_configuration: The kubernetes.client.Configuration to
        set configs to.
    :param persist_config: If True, config file will be updated when changed
        (e.g GCP token refresh).
    """

go-client-install

  • Related