kubernetes API Reference
Full documentation for kubernetes (36.0.3)
kubernetes.client
Python Library Documentation: package kubernetes.client in kubernetes
NAME
kubernetes.client - Kubernetes
DESCRIPTION
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: release-1.36
Generated by: https://openapi-generator.tech
PACKAGE CONTENTS
api (package)
api_client
apis (package)
configuration
exceptions
models (package)
rest
VERSION
36.0.3
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\kubernetes\client\__init__.py
kubernetes.config
Python Library Documentation: package kubernetes.config in kubernetes
NAME
kubernetes.config
DESCRIPTION
# Copyright 2016 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
PACKAGE CONTENTS
config_exception
dateutil
dateutil_test
exec_provider
exec_provider_test
incluster_config
incluster_config_test
kube_config
kube_config_test
FUNCTIONS
exists = _path_exists(path, /)
Test whether a path exists. Returns False for broken symbolic links.
load_config(**kwargs)
Wrapper function to load the kube_config.
It will initially try to load_kube_config from provided path,
then check if the KUBE_CONFIG_DEFAULT_LOCATION exists
If neither exists, it will fall back to load_incluster_config
and inform the user accordingly.
:param kwargs: A combination of all possible kwargs that
can be passed to either load_kube_config or
load_incluster_config functions.
DATA
KUBE_CONFIG_DEFAULT_LOCATION = '~/.kube/config'
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\kubernetes\config\__init__.py
kubernetes.dynamic
Python Library Documentation: package kubernetes.dynamic in kubernetes
NAME
kubernetes.dynamic
DESCRIPTION
# Copyright 2019 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
PACKAGE CONTENTS
client
discovery
exceptions
resource
test_client
test_discovery
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\kubernetes\dynamic\__init__.py
kubernetes.informer
Python Library Documentation: package kubernetes.informer in kubernetes
NAME
kubernetes.informer
DESCRIPTION
# Copyright 2026 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
PACKAGE CONTENTS
cache
informer
CLASSES
builtins.object
kubernetes.informer.cache.ObjectCache
kubernetes.informer.informer.SharedInformer
class ObjectCache(builtins.object)
| ObjectCache(key_func=None)
|
| Thread-safe in-memory mapping of Kubernetes objects.
|
| The SharedInformer keeps this store synchronised with the API server.
| Consumers can call list() and get_by_key() from any thread safely.
|
| Methods defined here:
|
| __init__(self, key_func=None)
| Initialize self. See help(type(self)) for accurate signature.
|
| get(self, obj)
| Look up the cached copy of obj. Returns None when absent.
|
| get_by_key(self, key)
| Look up an object by key. Returns None when absent.
|
| list(self)
| Return a snapshot list of all cached objects.
|
| list_keys(self)
| Return a snapshot list of all cache keys.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class SharedInformer(builtins.object)
| SharedInformer(list_func, namespace=None, resync_period=0, label_selector=None, field_selector=None, key_func=None)
|
| Watch a Kubernetes resource and maintain a local cache.
|
| The informer starts a daemon thread that continuously watches the
| given resource via ``list_func``. On each event the local
| :class:`ObjectCache` is updated and registered
| event-handler callbacks are invoked.
|
| Parameters
| ----------
| list_func:
| Bound API method used for the initial list **and** as the watch
| source. It must accept a watch keyword argument (e.g.
| CoreV1Api().list_namespaced_pod).
| namespace:
| Kubernetes namespace to watch. Pass None for cluster-scoped
| or all-namespace list functions.
| resync_period:
| How often (seconds) to perform a full re-list from the API server.
| Defaults to 0 which disables periodic resyncs.
| label_selector:
| Optional label selector string forwarded to the API server.
| field_selector:
| Optional field selector string forwarded to the API server.
| key_func:
| Optional callable (obj) -> str used to key objects in the
| cache. Defaults to namespace/name.
|
| Methods defined here:
|
| __init__(self, list_func, namespace=None, resync_period=0, label_selector=None, field_selector=None, key_func=None)
| Initialize self. See help(type(self)) for accurate signature.
|
| add_event_handler(self, event_type, handler)
| Register a callback for a specific event type.
|
| Parameters
| ----------
| event_type:
| One of :data:`ADDED`, :data:`MODIFIED`, :data:`DELETED`,
| :data:`BOOKMARK` or :data:`ERROR`.
| handler:
| Callable invoked with the event object (or the raw exception for
| ERROR events).
|
| remove_event_handler(self, event_type, handler)
| Deregister a previously registered *handler*.
|
| No-op if *handler* is not registered.
|
| start(self)
| Start the background watch loop in a daemon thread.
|
| Calling :meth:`start` more than once without an intervening
| :meth:`stop` is a no-op.
|
| stop(self)
| Ask the background watch loop to stop and join the thread.
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| cache
| The :class:`ObjectCache` maintained by this informer.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
FUNCTIONS
_meta_namespace_key(obj)
Build a lookup key from object metadata.
Supports both dict-based objects and generated model objects.
Returns namespace/name for namespaced objects, just name otherwise.
DATA
ADDED = 'ADDED'
BOOKMARK = 'BOOKMARK'
DELETED = 'DELETED'
ERROR = 'ERROR'
MODIFIED = 'MODIFIED'
__all__ = ['ObjectCache', '_meta_namespace_key', 'SharedInformer', 'AD...
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\kubernetes\informer\__init__.py
kubernetes.leaderelection
Python Library Documentation: package kubernetes.leaderelection in kubernetes
NAME
kubernetes.leaderelection
DESCRIPTION
# Copyright 2021 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
PACKAGE CONTENTS
electionconfig
example
leaderelection
leaderelection_test
leaderelectionrecord
resourcelock (package)
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\kubernetes\leaderelection\__init__.py
kubernetes.stream
Python Library Documentation: package kubernetes.stream in kubernetes
NAME
kubernetes.stream
DESCRIPTION
# Copyright 2017 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
PACKAGE CONTENTS
stream
ws_client
ws_client_test
DATA
portforward = functools.partial(<function _websocket_request a...0x000...
stream = functools.partial(<function _websocket_request a...tion webso...
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\kubernetes\stream\__init__.py
kubernetes.utils
Python Library Documentation: package kubernetes.utils in kubernetes
NAME
kubernetes.utils
DESCRIPTION
# Copyright 2018 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
PACKAGE CONTENTS
create_from_yaml
duration
metrics
quantity
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\kubernetes\utils\__init__.py
kubernetes.watch
Python Library Documentation: package kubernetes.watch in kubernetes
NAME
kubernetes.watch
DESCRIPTION
# Copyright 2016 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
PACKAGE CONTENTS
watch
watch_test
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\kubernetes\watch\__init__.py