Thanks to visit codestin.com
Credit goes to github.com

Skip to content

AttributeError: 'ApiClient' object has no attribute 'verify_ssl' #2368

Open
@cbaenziger

Description

@cbaenziger

What happened (please include outputs or screenshots):
Trying to setup a simple configuration I get the following Exception:

$ ./bin/python test.py 
Traceback (most recent call last):
  File "/home/cwb/kube_python_client/test.py", line 4, in <module>
    dynClient = dynamic.DynamicClient(api_client.ApiClient(configuration=conf))
                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/cwb/kube_python_client/lib/python3.12/site-packages/kubernetes/client/api_client.py", line 75, in __init__
    self.rest_client = rest.RESTClientObject(configuration)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/cwb/kube_python_client/lib/python3.12/site-packages/kubernetes/client/rest.py", line 61, in __init__
    if configuration.verify_ssl:
       ^^^^^^^^^^^^^^^^^^^^^^^^

Code and Kubeconfig:

$ cat test.py
from kubernetes import client, config, dynamic
from kubernetes.client import CustomObjectsApi, api_client
conf = config.kube_config.new_client_from_config(context="cbaenzig@mycluster")
dynClient = dynamic.DynamicClient(api_client.ApiClient(configuration=conf))
$ cat ~/.kube/config 
current-context: cbaenzig@mycluster
kind: Config
preferences: {}
users:
- name: me
  user:
    client-certificate: /tmp/test_key1
    client-key: /tmp/test_key2
clusters:
- cluster:
    server: https://mycluster.example.com:6443
  name: mycluster
contexts:
- context:
    cluster: mycluster
    namespace: default
    user: me
  name: cbaenzig@mycluster

Environment Setup and Test Run:

$ python -m venv  .
$ python -m venv --upgrade-deps .
$ source bin/activate
$ ./bin/python3 -m pip install kubernetes==32.0.1
$ ./bin/python test.py

What you expected to happen:
I expected to have a Dynamic Client object I could use to talk to the API server.

How to reproduce it (as minimally and precisely as possible):
Please see files above. No API server is necessary. Just use any client-certificate and client-key that will de-serialize.

Anything else we need to know?:

Environment:

  • Kubernetes version (kubectl version): <Not installed>
  • OS (e.g., MacOS 10.13.6): Ubuntu 24.04.2 LTS
  • Python version (python --version): Python 3.12.3
  • Python client version (pip list | grep kubernetes): kubernetes 32.0.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.lifecycle/staleDenotes an issue or PR has remained open with no activity and has become stale.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions