Git Product home page Git Product logo

Comments (9)

LeaveMyYard avatar LeaveMyYard commented on August 23, 2024

Hey, @marafa-sugarcrm

Could you please explain a little bit more about why -c setting do not work for you?
I think the error means that the cluster name that you provided does not exist in ~/.kube/config. Could it be the typo in your command?

from krr.

marafa-sugarcrm avatar marafa-sugarcrm commented on August 23, 2024

this is the error i get. even with just a simple -h

python krr.py -h
Traceback (most recent call last):
  File "$HOME/git/krr/robusta_krr/core/models/config.py", line 11, in <module>
    config.load_incluster_config()
  File "$HOME/.local/share/virtualenvs/krr-D82Oduqg/lib/python3.11/site-packages/kubernetes/config/incluster_config.py", line 121, in load_incluster_config
    try_refresh_token=try_refresh_token).load_and_set(client_configuration)
                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "$HOME/.local/share/virtualenvs/krr-D82Oduqg/lib/python3.11/site-packages/kubernetes/config/incluster_config.py", line 54, in load_and_set
    self._load_config()
  File "$HOME/.local/share/virtualenvs/krr-D82Oduqg/lib/python3.11/site-packages/kubernetes/config/incluster_config.py", line 62, in _load_config
    raise ConfigException("Service host/port is not set.")
kubernetes.config.config_exception.ConfigException: Service host/port is not set.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "$HOME/git/krr/krr.py", line 1, in <module>
    from robusta_krr import run
  File "$HOME/git/krr/robusta_krr/__init__.py", line 1, in <module>
    from .main import run
  File "$HOME/git/krr/robusta_krr/main.py", line 14, in <module>
    from robusta_krr.core.models.config import Config
  File "$HOME/git/krr/robusta_krr/core/models/config.py", line 14, in <module>
    config.load_kube_config()
  File "$HOME/.local/share/virtualenvs/krr-D82Oduqg/lib/python3.11/site-packages/kubernetes/config/kube_config.py", line 813, in load_kube_config
    loader = _get_kube_config_loader(
             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "$HOME/.local/share/virtualenvs/krr-D82Oduqg/lib/python3.11/site-packages/kubernetes/config/kube_config.py", line 773, in _get_kube_config_loader
    return KubeConfigLoader(
           ^^^^^^^^^^^^^^^^^
  File "$HOME/.local/share/virtualenvs/krr-D82Oduqg/lib/python3.11/site-packages/kubernetes/config/kube_config.py", line 206, in __init__
    self.set_active_context(active_context)
  File "$HOME/.local/share/virtualenvs/krr-D82Oduqg/lib/python3.11/site-packages/kubernetes/config/kube_config.py", line 259, in set_active_context
    self._current_context = self._config['contexts'].get_with_name(
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "$HOME/.local/share/virtualenvs/krr-D82Oduqg/lib/python3.11/site-packages/kubernetes/config/kube_config.py", line 660, in get_with_name
    raise ConfigException(
kubernetes.config.config_exception.ConfigException: Invalid kube-config file. Expected object with name  in $HOME/.kube/config/contexts list

from krr.

LeaveMyYard avatar LeaveMyYard commented on August 23, 2024

I think the issue might be related to kubectx, as you mentioned that you are using it.
In any case this is a bug and I will fix it in a future.

from krr.

yonahd avatar yonahd commented on August 23, 2024

@LeaveMyYard Does it not make more sense to first parse the parameters and then search for a kubeconfig?
I don't think krr should look for a kubeconfig if someone is only using the help flag

from krr.

LeaveMyYard avatar LeaveMyYard commented on August 23, 2024

@yonahd you are correct, and I think I fixed it a few days ago. Currently error with kubeconfig will only be shown in a runtime.

from krr.

LeaveMyYard avatar LeaveMyYard commented on August 23, 2024

Hey, @marafa-sugarcrm

Can you try the same with the latest version? The issue with an error on plain -h is fixed, but I think your exception was caused by python kubernetes-client not being able to parse your config for some reason. Can you confirm that this config works with kubectl?

Expected object with name in $HOME/.kube/config/contexts list

I think that the issue is that you have current-context: (an empty name) in your config, so it tries to search for that name (an empty string) in contexts and fails, but it could be something else also.

Once again, can you confirm that this exact configuration fails only in krr and not in other tools?

from krr.

LeaveMyYard avatar LeaveMyYard commented on August 23, 2024

I managed to reproduce your issue with empty current-context and added a fix for that. Please confirm that.

from krr.

LeaveMyYard avatar LeaveMyYard commented on August 23, 2024

Feel free to reopen if the fix did not help

from krr.

marafa-sugarcrm avatar marafa-sugarcrm commented on August 23, 2024

i do not set current context. that is correct . i always use --context to avoid barfing the wrong cluster

from krr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.