krkn-chaos / krkn

Chaos and resiliency testing tool for Kubernetes with a focus on improving performance under failure conditions. A CNCF sandbox project.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

kraken doesn't appear to respect kubeconfig_path in config.yaml

stratus-ss opened this issue · comments

I recently attempted to setup Kraken in an Openshift 4.10.x cluster. Following the instructions I created a kubeconfig cm like so:

oc create configmap kube-config --from-file=/home/ocp/vmware-temp/auth/kubeconfig

This created a cm which had:

data:
  kubeconfig:

Thus rendering the file to /root/.kube/kubeconfig. Realizing this I edited the config.yaml file so that the top of the file looks like this:

kraken:
    distribution: openshift                                # Distribution can be kubernetes or openshift
    kubeconfig_path: /root/.kube/kubeconfig                        # Path to kubeconfig

This caused the pods to crash:

2022-10-06 12:55:47,468 [INFO] Initializing client to talk to the Kubernetes cluster
 _              _              
| | ___ __ __ _| | _____ _ __  
| |/ / '__/ _` | |/ / _ \ '_ \ 
|   <| | | (_| |   <  __/ | | |
|_|\_\_|  \__,_|_|\_\___|_| |_|
                               

Traceback (most recent call last):
  File "/root/kraken/run_kraken.py", line 429, in <module>
    main(options.cfg)
  File "/root/kraken/run_kraken.py", line 105, in main
    kubecli.initialize_clients(kubeconfig_path)
  File "/root/kraken/kraken/kubernetes/client.py", line 33, in initialize_clients
    k8s_client = config.new_client_from_config()
  File "/usr/local/lib/python3.9/site-packages/kubernetes/config/kube_config.py", line 864, in new_client_from_config
    load_kube_config(config_file=config_file, context=context,
  File "/usr/local/lib/python3.9/site-packages/kubernetes/config/kube_config.py", line 808, in load_kube_config
    loader = _get_kube_config_loader(
  File "/usr/local/lib/python3.9/site-packages/kubernetes/config/kube_config.py", line 767, in _get_kube_config_loader
    raise ConfigException(
kubernetes.config.config_exception.ConfigException: Invalid kube-config file. No configuration **found.**

After speaking with @paigerube14 I tried editing the kubeconfig cm so that it read

data:
  config:

And then changed the path in the config.yaml so the path was /root/.kube/config and the pods started working.

The actual data inside the kube-config cm remained unedited. Only the heading (file name) changed.

I am unsure what caused this problem but it definitely seems like a bug

Issue should fixed, please feel free to let us know us if there are any issues. Thanks.