Skip to content

kubernetes.config.config_exception.ConfigException: Invalid kube-config file. Expected key users in kube-config #236

Description

@sidd14491

After installing Kubernets package used the script to list of all pods.
But After running the script I am observing following error.
File "1.py", line 4, in
config.load_kube_config()
File "build/bdist.linux-x86_64/egg/kubernetes/config/kube_config.py", line 311, in load_kube_config
File "build/bdist.linux-x86_64/egg/kubernetes/config/kube_config.py", line 282, in _get_kube_config_loader_for_yaml_file
File "build/bdist.linux-x86_64/egg/kubernetes/config/kube_config.py", line 118, in init
File "build/bdist.linux-x86_64/egg/kubernetes/config/kube_config.py", line 134, in set_active_context
File "build/bdist.linux-x86_64/egg/kubernetes/config/kube_config.py", line 253, in getitem
kubernetes.config.config_exception.ConfigException: Invalid kube-config file. Expected key users in kube-config

Activity

  1. mbohlool commented on May 26, 2017

    @mbohlool
    Contributor

    does kubectl works? can you share redacted kube config file content at ~/.kube/config?

  2. sidd14491 commented on May 27, 2017

    @sidd14491
    Author

    apiVersion: v1
    clusters:

    • cluster:
      server: http://10.213.18.39:8080
      name: test
      contexts:
    • context:
      cluster: test
      user: test
      name: test
      Yes Kubectl command is working fine
      Below the o/p of command
      root@csp-central-ms-vm1839:~/REQUESTS# kubectl get pods
      NAME READY STATUS RESTARTS AGE
      csp.admin-portal-ui-346402271-qnuw8 1/1 Running 0 24d
      csp.ams-2611059999-cypjx 1/1 Running 0
      24d
  3. added
    kind/bugCategorizes issue or PR as related to a bug.
    on May 30, 2017
  4. added a commit that references this issue on Jun 5, 2017
    7adf7e2
  5. pokoli commented on Jun 5, 2017

    @pokoli

    I uploaded a PR that should fix this issue, could you test please?

  6. mbohlool commented on Jun 5, 2017

    @mbohlool
    Contributor

    I commented on your (merged) PR. I think it is in the right direction but needs more fixes. It may fix @sidd14491 issue (sidd14491 can you confirm?) but need to fix this for all cases where user is missing.

  7. sidd14491 commented on Jun 6, 2017

    @sidd14491
    Author

    For verification which build I need to take.
    Can you mention the build location from where I'll take the fixed version and tested my scenario..
    Thanks.
    Siddharth

  8. pokoli commented on Jun 6, 2017

    @pokoli

    You have to install the latest version from sources. The following commands will do:

    git clone --recursive git@github.com:kubernetes-incubator/client-python.git
    cd client-python/kubernetes/base
    git checkout master
    cd ../..
    python setup.py install
    

    Then you can execute an example script with your client config. The following command will load the default context of your kube.cfg:

    python -m examples.example1

  9. pokoli commented on Jun 6, 2017

    @pokoli

    @mbohlool before closing this PR I think that we must update the git submodule to a revision that includes all the fixes. What do you think?

  10. mbohlool commented on Jun 6, 2017

    @mbohlool
    Contributor
  11. pokoli commented on Jun 7, 2017

    @pokoli

    I'm waiting for kubernetes-client/python-base#5 to be merged before updating submodules.

    For now we should keep the issue open. Can you reopen please?

  12. added a commit that references this issue on Jun 9, 2017
    cf2e840
  13. added a commit that references this issue on Jun 12, 2017
    c824cd7
  14. sidd14491 commented on Jun 16, 2017

    @sidd14491
    Author
  15. pokoli commented on Jun 16, 2017

    @pokoli

    @sidd14491 I don't see how your question is related to the current thread. Can you open a new issue please?

  16. sidd14491 commented on Jun 16, 2017

    @sidd14491
    Author
  17. pokoli commented on Jun 16, 2017

    @pokoli

    So please open a new issue for different questions....

  18. scottprichard commented on Jul 8, 2020

    @scottprichard

    of course this is closed.

  19. added a commit that references this issue on Jan 8, 2022
  20. added a commit that references this issue on Oct 7, 2022
    16742c6
  21. added a commit that references this issue on Apr 1, 2024
    6501a39
  22. added a commit that references this issue on Feb 4, 2026
    19e42b2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions