Official Python client library for kubernetes

Overview

Kubernetes Python Client

Build Status PyPI version codecov pypi supported versions Client Capabilities Client Support Level

Python client for the kubernetes API.

Installation

From source:

git clone --recursive https://github.com/kubernetes-client/python.git
cd python
python setup.py install

From PyPI directly:

pip install kubernetes

Examples

list all pods:

from kubernetes import client, config

# Configs can be set in Configuration class directly or using helper utility
config.load_kube_config()

v1 = client.CoreV1Api()
print("Listing pods with their IPs:")
ret = v1.list_pod_for_all_namespaces(watch=False)
for i in ret.items:
    print("%s\t%s\t%s" % (i.status.pod_ip, i.metadata.namespace, i.metadata.name))

watch on namespace object:

from kubernetes import client, config, watch

# Configs can be set in Configuration class directly or using helper utility
config.load_kube_config()

v1 = client.CoreV1Api()
count = 10
w = watch.Watch()
for event in w.stream(v1.list_namespace, _request_timeout=60):
    print("Event: %s %s" % (event['type'], event['object'].metadata.name))
    count -= 1
    if not count:
        w.stop()

print("Ended.")

More examples can be found in examples folder. To run examples, run this command:

python -m examples.example1

(replace example1 with one of the filenames in the examples folder)

Documentation

All APIs and Models' documentation can be found at the Generated client's README file

Compatibility

client-python follows semver, so until the major version of client-python gets increased, your code will continue to work with explicitly supported versions of Kubernetes clusters.

Compatibility matrix of supported client versions

  • client 9.y.z: Kubernetes 1.12 or below (+-), Kubernetes 1.13 (✓), Kubernetes 1.14 or above (+-)
  • client 10.y.z: Kubernetes 1.13 or below (+-), Kubernetes 1.14 (✓), Kubernetes 1.14 or above (+-)
  • client 11.y.z: Kubernetes 1.14 or below (+-), Kubernetes 1.15 (✓), Kubernetes 1.16 or above (+-)
  • client 12.y.z: Kubernetes 1.15 or below (+-), Kubernetes 1.16 (✓), Kubernetes 1.17 or above (+-)
  • client 17.y.z: Kubernetes 1.16 or below (+-), Kubernetes 1.17 (✓), Kubernetes 1.18 or above (+-)

See here for an explaination of why there is no v13-v16 release.

Key:

  • Exactly the same features / API objects in both client-python and the Kubernetes version.
  • + client-python has features or API objects that may not be present in the Kubernetes cluster, either due to that client-python has additional new API, or that the server has removed old API. However, everything they have in common (i.e., most APIs) will work. Please note that alpha APIs may vanish or change significantly in a single release.
  • - The Kubernetes cluster has features the client-python library can't use, either due to the server has additional new API, or that client-python has removed old API. However, everything they share in common (i.e., most APIs) will work.

See the CHANGELOG for a detailed description of changes between client-python versions.

Client version Canonical source for OpenAPI spec Maintenance status
5.0 Alpha/Beta Kubernetes main repo, 1.9 branch
5.0 Kubernetes main repo, 1.9 branch
6.0 Alpha/Beta Kubernetes main repo, 1.10 branch
6.0 Kubernetes main repo, 1.10 branch
7.0 Alpha/Beta Kubernetes main repo, 1.11 branch
7.0 Kubernetes main repo, 1.11 branch
8.0 Alpha/Beta Kubernetes main repo, 1.12 branch
8.0 Kubernetes main repo, 1.12 branch
9.0 Alpha/Beta Kubernetes main repo, 1.13 branch
9.0 Kubernetes main repo, 1.13 branch
10.0 Alpha/Beta Kubernetes main repo, 1.14 branch
10.0 Kubernetes main repo, 1.14 branch
11.0 Alpha/Beta Kubernetes main repo, 1.15 branch
11.0 Kubernetes main repo, 1.15 branch
12.0 Alpha/Beta Kubernetes main repo, 1.16 branch
12.0 Kubernetes main repo, 1.16 branch
17.0 Alpha/Beta Kubernetes main repo, 1.17 branch

See here for an explaination of why there is no v13-v16 release.

Key:

  • Changes in main Kubernetes repo are manually (should be automated) published to client-python when they are available.
  • No longer maintained; please upgrade.

Kubernetes supports three minor releases at a time. "Support" means we expect users to be running that version in production, though we may not port fixes back before the latest minor version. For example, when v1.3 comes out, v1.0 will no longer be supported. In consistent with Kubernetes support policy, we expect to support three GA major releases (corresponding to three Kubernetes minor releases) at a time.

Note: There would be no maintenance for alpha/beta releases except the latest one.

Exception to the above support rule: Since we are running behind on releases, we will support Alpha/Beta releases for a greater number of clients until we catch up with the upstream version.

Homogenizing the Kubernetes Python Client versions

The client releases v12 and before following a versioning schema where the major version was 4 integer positions behind the Kubernetes minor on which the client is based on. For example, v12.0.0 is based on Kubernetes v1.16, v11.0.0 is based on Kubernetes v1.15 and so on.

This created a lot of confusion tracking two different version numbers for each client release. It was decided to homogenize the version scheme starting from the Kubernetes Python client based on Kubernetes v1.17. The versioning scheme of the client from this release would be vY.Z.P where Y and Z are the Kubernetes minor and patch release numbers from Kubernets v1.Y.Z and P is the client specific patch release numbers to accomodate changes and fixes done specifically to the client. For more details, refer this issue.

Community, Support, Discussion

If you have any problem on using the package or any suggestions, please start with reaching the Kubernetes clients slack channel, or filing an issue to let us know. You can also reach the maintainers of this project at SIG API Machinery, where this project falls under.

Code of Conduct

Participation in the Kubernetes community is governed by the CNCF Code of Conduct.

Troubleshooting

SSLError on macOS

If you get an SSLError, you likely need to update your version of python. The version that ships with macOS may not be supported.

Install the latest version of python with brew:

brew install python

Once installed, you can query the version of OpenSSL like so:

python -c "import ssl; print ssl.OPENSSL_VERSION"

You'll need a version with OpenSSL version 1.0.0 or later.

Hostname doesn't match

If you get an ssl.CertificateError complaining about hostname match, your installed packages does not meet version requirements. Specifically check ipaddress and urllib3 package versions to make sure they met requirements in requirements.txt file.

Why Exec/Attach calls doesn't work

Starting from 4.0 release, we do not support directly calling exec or attach calls. you should use stream module to call them. so instead of resp = api.connect_get_namespaced_pod_exec(name, ... you should call resp = stream(api.connect_get_namespaced_pod_exec, name, ....

Using Stream will overwrite the requests protocol in core_v1_api.CoreV1Api() This will cause a failure in non-exec/attach calls. If you reuse your api client object, you will need to recreate it between api calls that use stream and other api calls.

See more at exec example.

Comments
  • Exec calls

    Exec calls

    Whenever I try to open an exec call I get:

    {
      "kind":"Status",
      "apiVersion":"v1",
      "metadata":{},
      "status":"Failure",
      "message":"Upgrade request required",
      "reason":"BadRequest","code":400
    }
    

    Which is related with the fact that requests is not SPDY compatible. Are you going to support this kind of requests in the near future?

    opened by diegodelemos 72
  • feat: add examples for asynchronous usage (callback, asycio)

    feat: add examples for asynchronous usage (callback, asycio)

    I added examples how to use a callback and how the library can be integrated with asyncio. Should I add this examples to readme too ?

    Related to https://github.com/kubernetes-incubator/client-python/issues/323

    cncf-cla: yes size/M lifecycle/rotten needs-kind 
    opened by tomplus 47
  • Delete kubernetes resources from yaml files , solves #940

    Delete kubernetes resources from yaml files , solves #940

    This is a method to delete kubernetes resources using the yaml files . It is similar to the method create_from_yaml but for deleting kubernetes resources . It can be used to any type pf resource deployment , pod , service etc. Fixes #940

    create_from_yaml creates kubernetes objects like deployments,serivces,ingress etc from the given yml files , the delete_from_yaml method can be used to remove/delete those objects from the same yml files in the given cluster for any namespace

    kind/feature cncf-cla: yes size/XL lifecycle/rotten release-note-none needs-rebase 
    opened by DiptoChakrabarty 40
  • Adding utils.deserialize

    Adding utils.deserialize

    Allows loading objects from json and yaml files. See for feature request https://github.com/kubernetes-client/python/issues/977

    Please review, this is my first pr.

    kind/feature cncf-cla: yes size/XXL lifecycle/rotten 
    opened by chekolyn 35
  • Examples show off `load_kube_config()` as the Right Way to set up the module, but an attempt at `load_incluster_config()` is also required to match the behavior of kubectl and work form inside pods

    Examples show off `load_kube_config()` as the Right Way to set up the module, but an attempt at `load_incluster_config()` is also required to match the behavior of kubectl and work form inside pods

    Link to the issue (please include a link to the specific documentation or example):

    See the examples in the README:

    https://github.com/kubernetes-client/python#examples

    Description of the issue (please include outputs or screenshots if possible):

    The examples of how to set up the module all (except for in_cluster_config.py) look like this:

    from kubernetes import client, config
    config.load_kube_config()
    v1 = client.CoreV1Api()
    # Do stuff with Kubernetes
    

    This gives the impression that this is all you need to do to pick up "the" Kubernetes configuration that your user is going to expect you to use (i.e. whatever kubectl would use). However, this is not the case.

    If you are running in a pod, and you want to use the configuration that kubectl picks up (for the pod's service account, talking to the current Kubertnetes), you need to run config.load_incluster_config() if/when config.load_kube_config() fails. Since, outside of very specialized situations, you don't really know where your user's will run your software or which method will produce the actual Kubernetes credentials in advance, the Right Way to connect to Kubernetes is not a single method call but a try/except, something like this:

    try:
        config.load_kube_config()
    except:
        # load_kube_config throws if there is no config, but does not document what it throws, so I can't rely on any particular type here
        config.load_incluster_config()
    

    The examples in the README, and possibly in the examples folder, should be changed to demonstrate credential loading that works like kubectl and pulls from either of these sources as available.

    Ideally, the two utility methods should be merged/wrapped in a utility method that loads whichever config is available.

    It looks like a similar proposal (with the order reversed) was made as part of #487, but that was part of a larger request, and it was killed by the stale bot without anyone actually solving this particular problem.

    kind/documentation lifecycle/rotten help wanted 
    opened by adamnovak 34
  • Convert JSON or Dict to client objects

    Convert JSON or Dict to client objects

    See also https://github.com/kubernetes-client/python/issues/340#issuecomment-526249075 (was closed for inactivity, NOT resolved) See also #63

    Motivation It is sometimes useful to be able to load Python objects from JSON, for example to read it from a config file. It should be possible to get Python objects from JSON, to pass around the code in a type-safe manner, for modification and ultimately sending through the client.

    Feature request There should be functions to convert JSON to objects and objects to JSON. This code already exists (it's required to talk to the API server), it should be exposed.

    Workaround? Right now, you can put this raw JSON into Python objects' fields, and the API client will apparently accept this, however if you use such mixed objects your code will probably break since their attribute names are different (API uses PascalCase, Python objects use snake_case). Even if taking care to handle that, you will reach the point where you have to handle things coming from the API client (Python objects using snake_case) differently from what you load from config files (JSON using PascalCase). Really messy.

    Right now I am left considering dropping this lib altogether and issuing requests directly, since the point of the wrapper is to expose safe typed Python classes instead of the raw JSON, but this doesn't work if you use any kind of config file.

    Current status It is somewhat possible to convert from a Python object to JSON using client.api_client.sanitize_for_serialization(), however converting from JSON to Python is completely impossible; the deserialize() method that exists expects a requests.Response, not JSON. Calling client.api_client._ApiClient__deserialize() works, but that is a private method, and you need to pass it the kind read from the JSON yourself.

    Apologies for duplicating #340 but I cannot re-open it myself.

    kind/feature lifecycle/rotten 
    opened by remram44 33
  • The library always uses port 80 when using the K8S_AUTH_KUBECONFIG env var

    The library always uses port 80 when using the K8S_AUTH_KUBECONFIG env var

    What happened (please include outputs or screenshots):

    Created a kubeconfig file stored in a different folder than the default one and I get the following error:

    fatal: [localhost]: FAILED! => {"changed": false, "msg": "Failed to get client due to HTTPConnectionPool(host='localhost', port=80): Max retries exceeded with url: /version (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f6f87772f10>: Failed to establish a new connection: [Errno 111] Connection refused'))"}
    

    What you expected to happen:

    A successful request.

    How to reproduce it (as minimally and precisely as possible):

    • pip install kubernetes==12.0.1
    • create a kubeconfig in another folder (changing the port if possible)
    • set K8S_AUTH_KUBECONFIG to the new kubeconfig file path
    • try to run a simple integration, such as creating a namespace
    • the error should show up

    Anything else we need to know?

    I am using the k8s ansible module but it works if I use an older version of the library (11.0.0).

    Environment:

    • Kubernetes version (kubectl version):
    Client Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.4", GitCommit:"d360454c9bcd1634cf4cc52d1867af5491dc9c5f", GitTreeState:"clean", BuildDate:"2020-11-11T13:17:17Z", GoVersion:"go1.15.2", Compiler:"gc", Platform:"linux/amd64"}
    
    Kind Container: latest-1.16
    
    
    • OS (e.g., MacOS 10.13.6): Linux
    • Python version (python --version): Python 3.7.7
    • Python client version (pip list | grep kubernetes): -12.0.1
    kind/bug lifecycle/rotten 
    opened by odra 32
  • Refresh token/api-key periodically

    Refresh token/api-key periodically

    Currently, authorization token/api-key is only initialized on loading config: https://github.com/kubernetes-client/python-base/blob/bd9a8525e9215f7f01c32a321beb9a605cf0402b/config/kube_config.py#L420 https://github.com/kubernetes-client/python-base/blob/bd9a8525e9215f7f01c32a321beb9a605cf0402b/config/kube_config.py#L510 When working with Amazon EKS via aws-iam-authenticator though, token/api-key expires relatively quickly.

    It is proposed to introduce a configurable option to specify token/api-key time-to-live. On API call the time should be checked, and if expired the token/api-key should be refreshed by calling https://github.com/kubernetes-client/python-base/blob/bd9a8525e9215f7f01c32a321beb9a605cf0402b/config/kube_config.py#L350 again. Alternatively, API client could check for 401 Unauthorized return code and refresh token (at most once per API call).

    opened by aparamon 30
  • How to reduce the retry count for python client?

    How to reduce the retry count for python client?

    What happened (please include outputs or screenshots):

    I am having a config file of a dead/deleted/inaccessible cluster. I am trying to accessing the cluster using kubernetes-client-python. By default kube-client retries it 3 times,

    WARNING Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x00000000096E3860>: Failed to establish a new connection: [Errno 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond',)': /api/v1/pods
    
    WARNING Retrying (Retry(total=1,....... /api/v1/pods
    
    WARNING Retrying (Retry(total=0,....... /api/v1/pods
    

    After 3 retries it throws an exception.

    Is there any way to reduce the count.

    Example Code

    from kubernetes import client, config
    
    config.load_kube_config(config_file='location-for-kube-config')
    
    v1 = client.CoreV1Api()
    ret = v1.list_pod_for_all_namespaces()
    for i in ret.items:
        print("%s\t%s\t%s" % (i.status.pod_ip, i.metadata.namespace, i.metadata.name))
    

    What you expected to happen:

    I need to configure the retry count for inaccessible/accessible k8s cluster.

    How to reproduce it (as minimally and precisely as possible):

    Delete the kubernetes cluster, then try to access the cluster using kubernetes-client-python. By default it will perform retry for 3 times.

    Anything else we need to know?:

    Environment:

    • Kubernetes version (kubectl version): Client Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.3", GitCommit:"5e53fd6bc17c0dec8434817e69b04a25d8ae0ff0", GitTreeState:"clean", BuildDate:"2019-06-06T01:44:30Z", GoVersion:"go1.12.5", Compiler:"gc", Platform:"windows/amd64"} Unable to connect to the server: dial tcp 149.129.128.208:6443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

    • OS: Windows 10

    • Python version (python --version) : Python 2.7.14

    • Python client version (pip list | grep kubernetes): kubernetes 10.0.1

    kind/bug lifecycle/rotten help wanted 
    opened by tathagatk22 29
  • No access to API server from pod in python

    No access to API server from pod in python

    Trying to access api service from the pod in python:

    from kubernetes import client, config
    core_v1 = client.CoreV1Api()
    config.load_incluster_config()
    core_v1.list_node()
    

    results in following error:

    # python
    Python 2.7.5 (default, Nov  6 2016, 00:28:07) 
    [GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    
    >>> from kubernetes import client, config
    >>> core_v1 = client.CoreV1Api()
    >>> config.load_incluster_config()
    >>> core_v1.list_node()         
    2017-06-14 13:52:41,486 WARNING Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x36c0e50>: Failed to establish a new connection: [Errno 111] Connection refused',)': /api/v1/nodes
    2017-06-14 13:52:41,487 WARNING Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x36b5b50>: Failed to establish a new connection: [Errno 111] Connection refused',)': /api/v1/nodes
    2017-06-14 13:52:41,487 WARNING Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x36b5c90>: Failed to establish a new connection: [Errno 111] Connection refused',)': /api/v1/nodes
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "build/bdist.linux-x86_64/egg/kubernetes/client/apis/core_v1_api.py", line 13284, in list_node
      File "build/bdist.linux-x86_64/egg/kubernetes/client/apis/core_v1_api.py", line 13377, in list_node_with_http_info
      File "build/bdist.linux-x86_64/egg/kubernetes/client/api_client.py", line 329, in call_api
      File "build/bdist.linux-x86_64/egg/kubernetes/client/api_client.py", line 153, in __call_api
      File "build/bdist.linux-x86_64/egg/kubernetes/client/api_client.py", line 361, in request
      File "build/bdist.linux-x86_64/egg/kubernetes/client/rest.py", line 240, in GET
      File "build/bdist.linux-x86_64/egg/kubernetes/client/rest.py", line 214, in request
      File "/usr/lib/python2.7/site-packages/urllib3-1.21.1-py2.7.egg/urllib3/request.py", line 66, in request
        **urlopen_kw)
      File "/usr/lib/python2.7/site-packages/urllib3-1.21.1-py2.7.egg/urllib3/request.py", line 87, in request_encode_url
        return self.urlopen(method, url, **extra_kw)
      File "/usr/lib/python2.7/site-packages/urllib3-1.21.1-py2.7.egg/urllib3/poolmanager.py", line 321, in urlopen
        response = conn.urlopen(method, u.request_uri, **kw)
      File "/usr/lib/python2.7/site-packages/urllib3-1.21.1-py2.7.egg/urllib3/connectionpool.py", line 678, in urlopen
        **response_kw)
      File "/usr/lib/python2.7/site-packages/urllib3-1.21.1-py2.7.egg/urllib3/connectionpool.py", line 678, in urlopen
        **response_kw)
      File "/usr/lib/python2.7/site-packages/urllib3-1.21.1-py2.7.egg/urllib3/connectionpool.py", line 678, in urlopen
        **response_kw)
      File "/usr/lib/python2.7/site-packages/urllib3-1.21.1-py2.7.egg/urllib3/connectionpool.py", line 649, in urlopen
        _stacktrace=sys.exc_info()[2])
      File "/usr/lib/python2.7/site-packages/urllib3-1.21.1-py2.7.egg/urllib3/util/retry.py", line 388, in increment
        raise MaxRetryError(_pool, url, error or ResponseError(cause))
    urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='localhost', port=443): Max retries exceeded with url: /api/v1/nodes (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x36b5d90>: Failed to establish a new connection: [Errno 111] Connection refused',))
    

    For some reason HTTPSConnectionPool is trying to access localhost instead of API server, though API url in kubernetes configuration seems to be correct:

    >>> from kubernetes.client import configuration
    >>> configuration.host
    'https://10.0.0.1:443'
    

    At the same time curl is working perfectly well: curl -v --cacert /var/run/secrets/kubernetes.io/serviceaccount/ca.crt -H "Authorization: Bearer $(cat /var/run/secrets/kubernetes.io/serviceaccount/token)" https://kubernetes/

    opened by sutasu 27
  • Delete from yaml

    Delete from yaml

    This is a method to delete kubernetes resources using the yaml files . It is similar to the method create_from_yaml but for deleting kubernetes resources . It can be used to any type pf resource deployment , pod , service etc. Fixes #940

    Resolved issue for tests failing for python2.7

    create_from_yaml creates kubernetes objects like deployments,serivces,ingress etc from the given yml files , the delete_from_yaml method can be used to remove/delete those objects from the same yml files in the given cluster for any namespace

    cncf-cla: yes size/XXL do-not-merge/hold 
    opened by DiptoChakrabarty 26
  • doc: comment pod_exec.py for multiple containers

    doc: comment pod_exec.py for multiple containers

    The behavior in kubectl for an exec is to run the exec command against the default container if there are multiple containers running in a pod (ie sidecars). However, the container needs to be specified with this python client call or an error of kind WebSocketBadStatusException will be raised. Add a comment in the example to explain this.

    What type of PR is this?

    /kind documentation

    What this PR does / why we need it:

    Document Side Car Container exec

    Firstly a big thank you to the maintainers of the python kubernetes-client I hope to offer help going forwards but am revisiting python for the first time in a decade.

    Problem Description

    During the normal use of the pod_exec.py example it came to my attention that when executing against a pod with multiple containers (ie sidecars) a WebSocketBadStatusException was raised. To fix this a container , often annotated as kubectl.kubernetes.io/default-container would need to be specified in the call. (when using kubectl the behavior when in an exec is to target the default container in the pod)

        resp = stream(api.connect_get_namespaced_pod_exec,
                      name=pod,
                      namespace='default',
                      command=exec_command,
                      container=container,
                      stdout=True, tty=False)
    

    I found this out via the issue 1870. I want to help others so that they can find this fix without the pain I had. I am suggesting a comment in the existing example. An alternative would be an example of pod_exec_for_side_cars.py which would give an example of how to use this with a pod that has sidecars.

    I would like to investigate the possibility of raising a better exception or targeting the default container in an exec call.

    Reproduction Notes

    I created a simple flask application and created an image from that tiny application. I Deployed this within a minikube cluster and followed the pod_exec.py example. I then installed istio onto my cluster and repeated the process. This time the pod_exec.py raised the exception.

    Which issue(s) this PR fixes:

    Documents case described in issue 1870 in the example to avoid others falling into the same issue

    Special notes for your reviewer:

    I have been out of the Python ecosystem for a long while but have come back as I see advantages for the work I do with GitOps applications. I would like to follow up on this code comment with possible changes via another PR that would raise a different error or use the default container if possible. I'm still reading the code and am not ready for that yet.

    Does this PR introduce a user-facing change?

    no

    Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:

    cncf-cla: yes size/XS kind/documentation do-not-merge/release-note-label-needed 
    opened by ghinks 4
  • Kubernetes Unprocessable entity error 422 in Fiber

    Kubernetes Unprocessable entity error 422 in Fiber

    kubernetes.client.rest.ApiException: (422)
    Reason: Unprocessable Entity
    HTTP response headers: HTTPHeaderDict({'Audit-Id': '05bf5b0d-9b42-46a1-ad55-11f090110308', 'Cache-Control': 'no-cache, private', 'Content-Type': 'application/json', 'X-Kubernetes-Pf-Flowschema-Uid': 'd9315622-7075-4100-b50b-c67adb228fcb', 'X-Kubernetes-Pf-Prioritylevel-Uid': '0fcf2002-2bc9-4505-ada7-f802af894cf4', 'Date': 'Wed, 28 Dec 2022 06:04:27 GMT', 'Content-Length': '1601'})
    HTTP response body: {"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"Pod \"poolworker-1:102-3e887fe2\" is invalid: [metadata.name: Invalid value: \"poolworker-1:102-3e887fe2\": a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*'), spec.containers[0].name: Invalid value: \"poolworker-1:102-3e887fe2\": a lowercase RFC 1123 label must consist of lower case alphanumeric characters or '-', and must start and end with an alphanumeric character (e.g. 'my-name',  or '123-abc', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?')]","reason":"Invalid","details":{"name":"poolworker-1:102-3e887fe2","kind":"Pod","causes":[{"reason":"FieldValueInvalid","message":"Invalid value: \"poolworker-1:102-3e887fe2\": a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')","field":"metadata.name"},{"reason":"FieldValueInvalid","message":"Invalid value: \"poolworker-1:102-3e887fe2\": a lowercase RFC 1123 label must consist of lower case alphanumeric characters or '-', and must start and end with an alphanumeric character (e.g. 'my-name',  or '123-abc', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?')","field":"spec.containers[0].name"}]},"code":422}
    
    
    
    2022-12-28 06:04:27,228 DEBUG:SpawnProcess-1(8):Thread-109 (safe_start)(140718488151808){process.py:203} create new process Process(PoolWorker-1:103, None)>
    2022-12-28 06:04:27,228 DEBUG:SpawnProcess-1(8):Thread-5 (_handle_workers)(140718471366400){pool.py:407} start multiprocessing.pool.worker starter thread(Thread-109 (safe_start):140718488151808)
    2022-12-28 06:04:27,228 DEBUG:SpawnProcess-1(8):Thread-5 (_handle_workers)(140718471366400){pool.py:411} _repolulate_pool_static done, pool: [Process(PoolWorker-1:102, None)>, Process(PoolWorker-1:103, None)>]
    2022-12-28 06:04:27,228 DEBUG:SpawnProcess-1(8):Thread-109 (safe_start)(140718488151808){popen_fiber_spawn.py:362} Process(PoolWorker-1:103, None)> <Popen(Process(PoolWorker-1:103, None)>)> _launch called
    2022-12-28 06:04:27,228 DEBUG:SpawnProcess-1(8):Thread-109 (safe_start)(140718488151808){popen_fiber_spawn.py:365} <Popen(Process(PoolWorker-1:103, None)>)> ipc_active is set, launch background thread
    2022-12-28 06:04:27,228 DEBUG:SpawnProcess-1(8):Thread-109 (safe_start)(140718488151808){popen_fiber_spawn.py:148} backend is "kubernetes", use python exe "/usr/local/bin/python"
    2022-12-28 06:04:27,228 DEBUG:SpawnProcess-1(8):Thread-109 (safe_start)(140718488151808){popen_fiber_spawn.py:402} <Popen(Process(PoolWorker-1:103, None)>)> popen_fiber_spawn created event <threading.Event object at 0x7ffb9073f730> and set _event_dict[103]
    2022-12-28 06:04:27,229 DEBUG:SpawnProcess-1(8):Thread-109 (safe_start)(140718488151808){config.py:141} loading config from .fiberconfig
    2022-12-28 06:04:27,229 DEBUG:SpawnProcess-1(8):Thread-109 (safe_start)(140718488151808){popen_fiber_spawn.py:414} <Popen(Process(PoolWorker-1:103, None)>)> prep_data: {'log_to_stderr': False, 'authkey': b'\xeaID\x04\xe9\xa7\xa78\xa9uj\x8b4\xc8\x14Y`\xde\x8f\x11\xbf\xb5!\xed#O\x133\xf3Oc\xb8', 'name': 'PoolWorker-1:103', 'sys_argv': ['/usr/local/bin/uvicorn', 'app:app', '--host', '0.0.0.0', '--reload'], 'orig_dir': '/app/app', 'dir': '/app/app', 'start_method': 'spawn', 'init_main_from_path': '/usr/local/bin/uvicorn', 'fiber_config': {'merge_output': False, 'debug': 'true', 'image': '898389633641.dkr.ecr.ap-southeast-1.amazonaws.com/user-service-backend:fiberpool', 'default_image': 'fiber-test:latest', 'backend': 'kubernetes', 'default_backend': 'local', 'use_bash': False, 'log_level': 10, 'log_file': 'stdout', 'ipc_active': True, 'ipc_admin_master_port': 0, 'ipc_admin_worker_port': 8000, 'cpu_per_job': 1, 'mem_per_job': None, 'use_push_queue': True}}
    2022-12-28 06:04:27,229 DEBUG:SpawnProcess-1(8):Thread-109 (safe_start)(140718488151808){popen_fiber_spawn.py:358} not in interactive shell, use reduction
    2022-12-28 06:04:27,229 DEBUG:SpawnProcess-1(8):Thread-109 (safe_start)(140718488151808){popen_fiber_spawn.py:358} not in interactive shell, use reduction
    2022-12-28 06:04:27,229 DEBUG:SpawnProcess-1(8):Thread-109 (safe_start)(140718488151808){kubernetes_backend.py:104} [k8s]create_job: <JobSpec: {'image': '898389633641.dkr.ecr.ap-southeast-1.amazonaws.com/user-service-backend:fiberpool', 'command': ['/usr/local/bin/python', '-u', '-c', 'import sys;import os;import socket;import struct;os.environ["FIBER_WORKER"]="1";os.chdir("/app/app");import fiber;import fiber.spawn;from multiprocessing import spawn, reduction;sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM);sock.connect(("100.116.197.251", 34991));conn = sock;conn.send(struct.pack("<I", 103));fd = conn.fileno();exitcode = fiber.spawn.spawn_prepare(fd);sys.exit(exitcode)', '--multiprocessing-fork'], 'name': 'PoolWorker-1:103', 'cpu': 1, 'gpu': None, 'mem': None, 'volumes': None}>
    2022-12-28 06:04:27,229 DEBUG:SpawnProcess-1(8):Thread-109 (safe_start)(140718488151808){kubernetes_backend.py:126} [k8s]create_job, container resource requirements: <JobSpec: {'image': '898389633641.dkr.ecr.ap-southeast-1.amazonaws.com/user-service-backend:fiberpool', 'command': ['/usr/local/bin/python', '-u', '-c', 'import sys;import os;import socket;import struct;os.environ["FIBER_WORKER"]="1";os.chdir("/app/app");import fiber;import fiber.spawn;from multiprocessing import spawn, reduction;sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM);sock.connect(("100.116.197.251", 34991));conn = sock;conn.send(struct.pack("<I", 103));fd = conn.fileno();exitcode = fiber.spawn.spawn_prepare(fd);sys.exit(exitcode)', '--multiprocessing-fork'], 'name': 'PoolWorker-1:103', 'cpu': 1, 'gpu': None, 'mem': None, 'volumes': None}>
    2022-12-28 06:04:27,229 DEBUG:SpawnProcess-1(8):Thread-109 (safe_start)(140718488151808){kubernetes_backend.py:165} [k8s]calling create_namespaced_pod: poolworker-1:103-bf254681
    

    I am trying to use fiber by uber to do multiprocessing in a cluster. I am getting error telling theres a unprocessable entity. Kubernetes client version == 10.0.1. In the above logs you can see fiber tries to create pods for the multiprocessing but it fails cause of kubernetes gives out a 422 error.

    Above I have given the logs in the debug mode so it would be easier to solve. Thanks in advance

    kind/bug 
    opened by sakmalh 0
  • request timeout doesnt work

    request timeout doesnt work

    When using request timeout:

        api = eks_client.resources.get(api_version="keda.sh/v1alpha1", kind="ScaledObject",_request_timeout=30)
    

    or:

            eks_client.patch(resource=resource_class, namespace=namespace, name=deployment, body=body, content_type="application/merge-patch+json",_request_timeout=30)
    

    it doesnt work:

    AttributeError: 'DynamicClient' object has no attribute '_request_timeout'
    

    i am using the dynamic client:

        eks_client = dynamic.DynamicClient(
            api_client.ApiClient(configuration=config.load_kube_config())
        )
    

    as i read here: https://github.com/kubernetes-client/python/blob/release-25.0/kubernetes/client/api_client.py#L336 and here: https://github.com/kubernetes-client/python/blob/master/examples/watch/timeout-settings.md

    it should be possible to set timeouts for requests, am i missing something here? are there any examples of how to use the timeout properly or is it a bug?

    Environment:

    • Kubernetes version (kubectl version):
    Client Version: v1.25.0
    Kustomize Version: v4.5.7
    Server Version: v1.23.13-eks-fb459a0
    
    • OS (e.g., MacOS 10.13.6):
    12.5.1 (21G83)
    
    • Python version (python --version)
     python --version
    Python 3.9.15
    
    • Python client version (pip list | grep kubernetes)
    pip list | grep kubernetes
    kubernetes               25.3.0
    
    kind/bug 
    opened by arnoldyahad 1
  • need support for python 3.11

    need support for python 3.11

    What is the feature and why do you need it: as python 3.11.0 is released officially. when will be kubernetes-client upgraded as well?

    Describe the solution you'd like to see: I hope this package can work under python 3.11.0

    kind/feature 
    opened by zffocussss 0
  • Convert timeout to milliseconds when using poll method

    Convert timeout to milliseconds when using poll method

    What type of PR is this?

    /kind. bug

    What this PR does / why we need it:

    Makes poll/select timeout consistent.

    Which issue(s) this PR fixes:

    Fixes #1963

    Special notes for your reviewer:

    Does this PR introduce a user-facing change?

    The timeout unit of the WSClient update method is now always seconds for both poll and select functions.
    

    Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:

    
    
    kind/bug cncf-cla: yes size/XS release-note 
    opened by t-yrka 3
  • Floating

    Floating "KeyError" error when trying to load logs from OpenShift pods

    Hello everyone. I have python script (kubernetes 24.2.0, openshift 0.13.1), which is able to download logs from OpenShift pods:

    def authorization(api_host):  # OpenShift authorization
        encoded = base64_decode(read_from_file('authorization')[0])
        username = encoded[0]
        password = encoded[1]
        kubeConfig = OCPLoginConfiguration(ocp_username=username, ocp_password=password)
        kubeConfig.host = api_host
        kubeConfig.verify_ssl = False
        kubeConfig.get_token()
       k8s_client = client.ApiClient(kubeConfig)
        return DynamicClient(k8s_client)
     
     
    def list_namespaces(dyn_client):  # List namespaces
        v1_projects = dyn_client.resources.get(api_version='project.openshift.io/v1', kind='Project')
        project_list = v1_projects.get()
        return project_list
     
     
    def pods_list(namespace, dyn_client):  # Get pods list from project
        v2_pods = dyn_client.resources.get(api_version='v1', kind='Pod')
        return v2_pods.get(namespace=namespace)
     
     
    def pods_logs(namespace, pod_name, dyn_client, time_limit, container_type):
        pod_logs = dyn_client.resources.get(api_version='v1', kind='Pod')
        get_pods_logs = pod_logs.get(namespace=namespace, name=pod_name + '/log',
                                     query_params={'container': container_type, 'sinceSeconds': time_limit})
        get_pods_logs_list = get_pods_logs.split('\n')
        return get_pods_logs_list
     
     
    log_array = pods_logs(project, item.metadata.name, dyn_client,
                                          int(read_from_file('dynamic_time')[0]) + 30, container_type)
    

    Here is sample of logs in pod, json format:

    {"level":"info","ts":"[2022-12-19](tel:2022-12-19)T19:03:08Z","msg":"Success request","app":"some_app","version":"D-01.01","request_id":"i12345","status_code":200,"duration":0.[000212049](tel:000212049)}
    {"level":"info","ts":"[2022-12-19](tel:2022-12-19)T19:03:48Z","msg":"Success request","app":"some_app","version":"D-01.01","request_id":"i21345","status_code":200,"duration":0.[000215956](tel:000215956)}
    {"level":"info","ts":"[2022-12-19](tel:2022-12-19)T19:04:52Z","msg":"Success request","app":"some_app","version":"D-01.01","request_id":"i31245","status_code":200,"duration":0.[000213351](tel:000213351)}
    {"level":"info","ts":"[2022-12-19](tel:2022-12-19)T19:05:20Z","msg":"Success request","app":"some_app","version":"D-01.01","request_id":"i41235","status_code":200,"duration":0.[00022091](tel:00022091)}
    {"level":"info","ts":"[2022-12-19](tel:2022-12-19)T19:06:11Z","msg":"Success request","app":"some_app","version":"D-01.01","request_id":"i51234","status_code":200,"duration":0.[000254497](tel:000254497)}
    {"level":"info","ts":"[2022-12-19](tel:2022-12-19)T19:07:08Z","msg":"Success request","app":"some_app","version":"D-01.01","request_id":"i54321","status_code":200,"duration":0.[000315131](tel:000315131)}
    

    Error occurs randomly, script can run 10 hours + without problems

    File "C:\Users\SomeUser\PycharmProjects\Monitoring_Test\lambda_monitoring\lambda_helper.py", line 107, in get_metrics
        log_array = pods_logs(project, item.metadata.name, dyn_client, int(read_from_file('dynamic_time')[0]) + 30, container_type )
      File "C:\Users\SomeUser\PycharmProjects\Monitoring_Test\lambda_monitoring\lambda_helper.py", line 76, in pods_logs
        get_pods_logs = pod_logs.get(namespace=namespace, name=pod_name + '/log',
      File "C:\Users\SomeUser\PycharmProjects\Monitoring_Test\venv\lib\site-packages\kubernetes\dynamic\client.py", line 112, in get
        return self.request('get', path, **kwargs)
      File "C:\Users\SomeUser\PycharmProjects\Monitoring_Test\venv\lib\site-packages\kubernetes\dynamic\client.py", line 62, in inner
        return serializer(self, json.loads(resp.data.decode('utf8')))
      File "C:\Users\SomeUser\PycharmProjects\Monitoring_Test\venv\lib\site-packages\kubernetes\dynamic\resource.py", line 287, in __init__
        kind = instance['kind']
    KeyError: 'kind'
    

    kubernetes/dymamic/resource.py

    class ResourceInstance(object):
        """ A parsed instance of an API resource. It exists solely to
            ease interaction with API objects by allowing attributes to
            be accessed with '.' notation.
        """
     
        def __init__(self, client, instance):
            self.client = client
            # If we have a list of resources, then set the apiVersion and kind of
            # each resource in 'items'
            kind = instance['kind']
            if kind.endswith('List') and 'items' in instance:
                kind = instance['kind'][:-4]
                for item in instance['items']:
                    if 'apiVersion' not in item:
                        item['apiVersion'] = instance['apiVersion']
                    if 'kind' not in item:
                        item['kind'] = kind
     
            self.attributes = self.__deserialize(instance)
            self.__initialised = True
    
    opened by nex1gen 0
Releases(v25.3.0)
  • v25.3.0(Oct 26, 2022)

    Getting started:

    pip install --pre --upgrade kubernetes
    

    Or from source, download attached zip file, then

    unzip client-python-v25.3.0.zip
    cd client-python-v25.3.0
    python setup.py install
    

    Then follow examples in https://github.com/kubernetes-client/python/tree/release-25.0/examples

    Changelog: https://github.com/kubernetes-client/python/blob/release-25.0/CHANGELOG.md

    Source code(tar.gz)
    Source code(zip)
  • v25.3.0b1(Oct 20, 2022)

    Getting started:

    pip install --pre --upgrade kubernetes
    

    Or from source, download attached zip file, then

    unzip client-python-v25.3.0b1.zip
    cd client-python-v25.3.0b1
    python setup.py install
    

    Then follow examples in https://github.com/kubernetes-client/python/tree/release-25.0/examples

    Changelog: https://github.com/kubernetes-client/python/blob/release-25.0/CHANGELOG.md

    Source code(tar.gz)
    Source code(zip)
  • v25.2.0a1(Oct 13, 2022)

    Getting started:

    pip install --pre --upgrade kubernetes
    

    Or from source, download attached zip file, then

    unzip client-python-v25.2.0a1.zip
    cd client-python-v25.2.0a1
    python setup.py install
    

    Then follow examples in https://github.com/kubernetes-client/python/tree/release-25.0/examples

    Changelog: https://github.com/kubernetes-client/python/blob/release-25.0/CHANGELOG.md

    Source code(tar.gz)
    Source code(zip)
  • v24.2.0(Jun 22, 2022)

    Getting started:

    pip install --pre --upgrade kubernetes
    

    Or from source, download attached zip file, then

    unzip client-python-v24.2.0.zip
    cd client-python-v24.2.0
    python setup.py install
    

    Then follow examples in https://github.com/kubernetes-client/python/tree/release-24.0/examples

    Changelog: https://github.com/kubernetes-client/python/blob/release-24.0/CHANGELOG.md

    Source code(tar.gz)
    Source code(zip)
  • v24.1.0b1(Jun 13, 2022)

    Getting started:

    pip install --pre --upgrade kubernetes
    

    Or from source, download attached zip file, then

    unzip client-python-v24.1.0b1.zip
    cd client-python-v24.1.0b1
    python setup.py install
    

    Then follow examples in https://github.com/kubernetes-client/python/tree/release-24.0/examples

    Changelog: https://github.com/kubernetes-client/python/blob/release-24.0/CHANGELOG.md

    Source code(tar.gz)
    Source code(zip)
  • v24.1.0a1(Jun 7, 2022)

    Getting started:

    pip install --pre --upgrade kubernetes
    

    Or from source, download attached zip file, then

    unzip client-python-v24.1.0a1.zip
    cd client-python-v24.1.0a1
    python setup.py install
    

    Then follow examples in https://github.com/kubernetes-client/python/tree/release-24.0/examples

    Changelog: https://github.com/kubernetes-client/python/blob/release-24.0/CHANGELOG.md

    Source code(tar.gz)
    Source code(zip)
  • v23.6.0(May 6, 2022)

    Getting started:

    pip install --pre --upgrade kubernetes
    

    Or from source, download attached zip file, then

    unzip client-python-v23.6.0.zip
    cd client-python-v23.6.0
    python setup.py install
    

    Then follow examples in https://github.com/kubernetes-client/python/tree/release-23.0/examples

    Changelog: https://github.com/kubernetes-client/python/blob/release-23.0/CHANGELOG.md

    Source code(tar.gz)
    Source code(zip)
  • v23.3.0(Feb 28, 2022)

    Getting started:

    pip install --pre --upgrade kubernetes
    

    Or from source, download attached zip file, then

    unzip client-python-v23.3.0.zip
    cd client-python-v23.3.0
    python setup.py install
    

    Then follow examples in https://github.com/kubernetes-client/python/tree/release-23.0/examples

    Changelog: https://github.com/kubernetes-client/python/blob/release-23.0/CHANGELOG.md

    Source code(tar.gz)
    Source code(zip)
  • v23.3.0b1(Feb 22, 2022)

    Getting started:

    pip install --pre --upgrade kubernetes
    

    Or from source, download attached zip file, then

    unzip client-python-v23.3.0b1.zip
    cd client-python-v23.3.0b1
    python setup.py install
    

    Then follow examples in https://github.com/kubernetes-client/python/tree/release-23.0/examples

    Changelog: https://github.com/kubernetes-client/python/blob/release-23.0/CHANGELOG.md

    Source code(tar.gz)
    Source code(zip)
  • v23.3.0a1(Feb 15, 2022)

    Getting started:

    pip install --pre --upgrade kubernetes
    

    Or from source, download attached zip file, then

    unzip client-python-v23.3.0a1.zip
    cd client-python-v23.3.0a1
    python setup.py install
    

    Then follow examples in https://github.com/kubernetes-client/python/tree/release-23.0/examples

    Changelog: https://github.com/kubernetes-client/python/blob/release-23.0/CHANGELOG.md

    Source code(tar.gz)
    Source code(zip)
  • v22.6.0(Feb 14, 2022)

    Getting started:

    pip install --pre --upgrade kubernetes
    

    Or from source, download attached zip file, then

    unzip client-python-v22.6.0.zip
    cd client-python-v22.6.0
    python setup.py install
    

    Then follow examples in https://github.com/kubernetes-client/python/tree/release-22.0/examples

    Changelog: https://github.com/kubernetes-client/python/blob/release-22.0/CHANGELOG.md

    Source code(tar.gz)
    Source code(zip)
  • v22.6.0b1(Feb 8, 2022)

    Getting started:

    pip install --pre --upgrade kubernetes
    

    Or from source, download attached zip file, then

    unzip client-python-v22.6.0b1.zip
    cd client-python-v22.6.0b1
    python setup.py install
    

    Then follow examples in https://github.com/kubernetes-client/python/tree/release-22.0/examples

    Changelog: https://github.com/kubernetes-client/python/blob/release-22.0/CHANGELOG.md

    Source code(tar.gz)
    Source code(zip)
  • v22.6.0a1(Jan 31, 2022)

    Getting started:

    pip install --pre --upgrade kubernetes
    

    Or from source, download attached zip file, then

    unzip client-python-v22.6.0a1.zip
    cd client-python-v22.6.0a1
    python setup.py install
    

    Then follow examples in https://github.com/kubernetes-client/python/tree/release-22.0/examples

    Changelog: https://github.com/kubernetes-client/python/blob/release-22.0/CHANGELOG.md

    Source code(tar.gz)
    Source code(zip)
  • v21.7.0(Dec 15, 2021)

    Getting started:

    pip install kubernetes==21.7.0
    

    Or from source, download attached zip file, then

    unzip client-python-21.7.0.zip
    cd client-python-21.7.0
    python setup.py install
    

    Then follow examples in https://github.com/kubernetes-client/python/tree/release-21.0/examples.

    Changelog: https://github.com/kubernetes-client/python/blob/release-21.0/CHANGELOG.md

    Source code(tar.gz)
    Source code(zip)
  • v21.7.0b1(Dec 6, 2021)

    Getting started:

    pip install --pre --upgrade kubernetes
    

    Or from source, download attached zip file, then

    unzip client-python-v21.7.0b1.zip
    cd client-python-v21.7.0b1
    python setup.py install
    

    Then follow examples in https://github.com/kubernetes-client/python/tree/release-21.0/examples

    Changelog: https://github.com/kubernetes-client/python/blob/release-21.0/CHANGELOG.md

    Source code(tar.gz)
    Source code(zip)
  • v21.7.0a1(Nov 30, 2021)

    Getting started:

    pip install --pre --upgrade kubernetes
    

    Or from source, download attached zip file, then

    unzip client-python-v21.7.0a1.zip
    cd client-python-v21.7.0a1
    python setup.py install
    

    Then follow examples in https://github.com/kubernetes-client/python/tree/release-21.0/examples

    Changelog: https://github.com/kubernetes-client/python/blob/release-21.0/CHANGELOG.md

    Source code(tar.gz)
    Source code(zip)
  • v20.13.0(Nov 29, 2021)

    Getting started:

    pip install kubernetes==20.13.0
    

    Or from source, download attached zip file, then

    unzip client-python-20.13.0.zip
    cd client-python-20.13.0
    python setup.py install
    

    Then follow examples in https://github.com/kubernetes-client/python/tree/release-20.0/examples.

    Changelog: https://github.com/kubernetes-client/python/blob/release-20.0/CHANGELOG.md

    Source code(tar.gz)
    Source code(zip)
  • v20.12.0b1(Nov 8, 2021)

    Getting started:

    pip install --pre --upgrade kubernetes Or from source, download attached zip file, then

    unzip client-python-v20.12.0b1.zip cd client-python-v20.12.0b1 python setup.py install Then follow examples in https://github.com/kubernetes-client/python/tree/release-20.0/examples

    Changelog: https://github.com/kubernetes-client/python/blob/release-20.0/CHANGELOG.md

    Source code(tar.gz)
    Source code(zip)
  • v20.11.0a1(Oct 27, 2021)

    Getting started:

    pip install --pre --upgrade kubernetes
    

    Or from source, download attached zip file, then

    unzip client-python-v20.11.0a1.zip
    cd client-python-v20.11.0a1
    python setup.py install
    

    Then follow examples in https://github.com/kubernetes-client/python/tree/release-20.0/examples

    Changelog: https://github.com/kubernetes-client/python/blob/release-20.0/CHANGELOG.md

    Source code(tar.gz)
    Source code(zip)
  • v19.15.0(Oct 25, 2021)

    Getting started:

    pip install kubernetes==19.15.0
    

    Or from source, download attached zip file, then

    unzip client-python-19.15.0.zip
    cd client-python-19.15.0
    python setup.py install
    

    Then follow examples in https://github.com/kubernetes-client/python/tree/release-19.0/examples.

    Changelog: https://github.com/kubernetes-client/python/blob/release-19.0/CHANGELOG.md

    Source code(tar.gz)
    Source code(zip)
  • v19.15.0b1(Oct 13, 2021)

    Getting started:

    pip install --pre --upgrade kubernetes
    

    Or from source, download attached zip file, then

    unzip client-python-v19.15.0b1.zip
    cd client-python-v19.15.0b1
    python setup.py install
    

    Then follow examples in https://github.com/kubernetes-client/python/tree/release-19.0/examples

    Changelog: https://github.com/kubernetes-client/python/blob/release-19.0/CHANGELOG.md

    Source code(tar.gz)
    Source code(zip)
  • v19.15.0a1(Sep 20, 2021)

    Getting started:

    pip install --pre --upgrade kubernetes
    

    Or from source, download attached zip file, then

    unzip client-python-v19.15.0a1.zip
    cd client-python-v19.15.0a1
    python setup.py install
    

    Then follow examples in https://github.com/kubernetes-client/python/tree/release-19.0/examples

    Changelog: https://github.com/kubernetes-client/python/blob/release-19.0/CHANGELOG.md

    Source code(tar.gz)
    Source code(zip)
  • v18.20.0(Aug 16, 2021)

    Getting started:

    pip install kubernetes==18.20.0
    

    Or from source, download attached zip file, then

    unzip client-python-18.20.0.zip
    cd client-python-18.20.0
    python setup.py install
    

    Then follow examples in https://github.com/kubernetes-client/python/tree/release-18.0/examples.

    Changelog: https://github.com/kubernetes-client/python/blob/release-18.0/CHANGELOG.md

    Source code(tar.gz)
    Source code(zip)
  • v18.20.0b1(Jun 21, 2021)

    Getting started:

    pip install --pre --upgrade kubernetes
    

    Or from source, download attached zip file, then

    unzip client-python-v18.20.0b1.zip
    cd client-python-v18.20.0b1
    python setup.py install
    

    Then follow examples in https://github.com/kubernetes-client/python/tree/release-18.0/examples

    Changelog: https://github.com/kubernetes-client/python/blob/release-18.0/CHANGELOG.md

    Source code(tar.gz)
    Source code(zip)
  • v17.17.0(May 12, 2021)

    Getting started:

    pip install kubernetes==17.17.0
    

    Or from source, download attached zip file, then

    unzip client-python-17.17.0.zip
    cd client-python-17.17.0
    python setup.py install
    

    Then follow examples in https://github.com/kubernetes-client/python/tree/release-17.0/examples.

    Changelog: https://github.com/kubernetes-client/python/blob/release-17.0/CHANGELOG.md

    Source code(tar.gz)
    Source code(zip)
  • v17.17.0b1(May 3, 2021)

    Getting started:

    pip install --pre --upgrade kubernetes
    

    Or from source, download attached zip file, then

    unzip client-python-v17.17.0b1.zip
    cd client-python-v17.17.0b1
    python setup.py install
    

    Then follow examples in https://github.com/kubernetes-client/python/tree/release-17.0/examples

    Changelog: https://github.com/kubernetes-client/python/blob/release-17.0/CHANGELOG.md

    Source code(tar.gz)
    Source code(zip)
  • v18.17.0a1(Apr 19, 2021)

    Getting started:

    pip install --pre --upgrade kubernetes
    

    Or from source, download attached zip file, then

    unzip client-python-v18.17.0a1.zip
    cd client-python-v18.17.0a1
    python setup.py install
    

    Then follow examples in https://github.com/kubernetes-client/python/tree/release-18.0/examples

    Changelog: https://github.com/kubernetes-client/python/blob/release-18.0/CHANGELOG.md

    Source code(tar.gz)
    Source code(zip)
  • v17.14.0a1(Nov 13, 2020)

    Getting started:

    pip install --pre --upgrade kubernetes
    

    Or from source, download attached zip file, then

    unzip client-python-v17.14.0a1.zip
    cd client-python-v17.14.0a1
    python setup.py install
    

    Then follow examples in https://github.com/kubernetes-client/python/tree/release-17.0/examples

    Changelog: https://github.com/kubernetes-client/python/blob/release-17.0/CHANGELOG.md

    Source code(tar.gz)
    Source code(zip)
  • v12.0.1(Nov 9, 2020)

    Getting started:

    pip install kubernetes==12.0.1
    

    Or from source, download attached zip file, then

    unzip client-python-12.0.1.zip
    cd client-python-12.0.1
    python setup.py install
    

    Then follow examples in https://github.com/kubernetes-client/python/tree/release-12.0/examples.

    Changelog: https://github.com/kubernetes-client/python/blob/release-12.0/CHANGELOG.md

    Source code(tar.gz)
    Source code(zip)
  • v12.0.0(Oct 15, 2020)

    Getting started:

    pip install kubernetes==12.0.0
    

    Or from source, download attached zip file, then

    unzip client-python-12.0.0.zip
    cd client-python-12.0.0
    python setup.py install
    

    Then follow examples in https://github.com/kubernetes-client/python/tree/release-12.0/examples.

    Changelog: https://github.com/kubernetes-client/python/blob/release-12.0/CHANGELOG.md

    Source code(tar.gz)
    Source code(zip)
Owner
Kubernetes Clients
This organization hosts Kubernetes API client libraries.
Kubernetes Clients
Google Kubernetes Engine (GKE) with a Snyk Kubernetes controller installed/configured for Snyk App

Google Kubernetes Engine (GKE) with a Snyk Kubernetes controller installed/configured for Snyk App This example provisions a Google Kubernetes Engine

Pas Apicella 2 Feb 9, 2022
Coding For Entrepreneurs 100 Jan 1, 2023
Helperpod - A CLI tool to run a Kubernetes utility pod with pre-installed tools that can be used for debugging/testing purposes inside a Kubernetes cluster

Helperpod is a CLI tool to run a Kubernetes utility pod with pre-installed tools that can be used for debugging/testing purposes inside a Kubernetes cluster.

Atakan Tatlı 2 Feb 5, 2022
Linux, Jenkins, AWS, SRE, Prometheus, Docker, Python, Ansible, Git, Kubernetes, Terraform, OpenStack, SQL, NoSQL, Azure, GCP, DNS, Elastic, Network, Virtualization. DevOps Interview Questions

Linux, Jenkins, AWS, SRE, Prometheus, Docker, Python, Ansible, Git, Kubernetes, Terraform, OpenStack, SQL, NoSQL, Azure, GCP, DNS, Elastic, Network, Virtualization. DevOps Interview Questions

Arie Bregman 35.1k Jan 2, 2023
This repository contains code examples and documentation for learning how applications can be developed with Kubernetes

BigBitBus KAT Components Click on the diagram to enlarge, or follow this link for detailed documentation Introduction Welcome to the BigBitBus Kuberne

null 51 Oct 16, 2022
A Blazing fast Security Auditing tool for Kubernetes

A Blazing fast Security Auditing tool for kubernetes!! Basic Overview Kubestriker performs numerous in depth checks on kubernetes infra to identify th

Vasant Chinnipilli 934 Jan 4, 2023
A Kubernetes operator that creates UptimeRobot monitors for your ingresses

This operator automatically creates uptime monitors at UptimeRobot for your Kubernetes Ingress resources. This allows you to easily integrate uptime monitoring of your services into your Kubernetes deployments.

Max 49 Dec 14, 2022
A Simple script to hunt unused Kubernetes resources.

K8SPurger A Simple script to hunt unused Kubernetes resources. Release History Release 0.3 Added Ingress Added Services Account Adding RoleBindding Re

Yogesh Kunjir 202 Nov 19, 2022
Run Oracle on Kubernetes with El Carro

El Carro is a new project that offers a way to run Oracle databases in Kubernetes as a portable, open source, community driven, no vendor lock-in container orchestration system. El Carro provides a powerful declarative API for comprehensive and consistent configuration and deployment as well as for real-time operations and monitoring.

Google Cloud Platform 205 Dec 30, 2022
Chartreuse: Automated Alembic migrations within kubernetes

Chartreuse: Automated Alembic SQL schema migrations within kubernetes "How to automate management of Alembic database schema migration at scale using

Wiremind 8 Oct 25, 2022
sysctl/sysfs settings on a fly for Kubernetes Cluster. No restarts are required for clusters and nodes.

SysBindings Daemon Little toolkit for control the sysctl/sysfs bindings on Kubernetes Cluster on the fly and without unnecessary restarts of cluster o

Wallarm 19 May 6, 2022
Caboto, the Kubernetes semantic analysis tool

Caboto Caboto, the Kubernetes semantic analysis toolkit. It contains a lightweight Python library for semantic analysis of plain Kubernetes manifests

Michael Schilonka 8 Nov 26, 2022
Hubble - Network, Service & Security Observability for Kubernetes using eBPF

Network, Service & Security Observability for Kubernetes What is Hubble? Getting Started Features Service Dependency Graph Metrics & Monitoring Flow V

Cilium 2.4k Jan 4, 2023
Rancher Kubernetes API compatible with RKE, RKE2 and maybe others?

kctl Rancher Kubernetes API compatible with RKE, RKE2 and maybe others? Documentation is WIP. Quickstart pip install --upgrade kctl Usage from lazycls

null 1 Dec 2, 2021
A charmed operator for running PGbouncer on kubernetes.

operator-template Description TODO: Describe your charm in a few paragraphs of Markdown Usage TODO: Provide high-level usage, such as required config

Canonical 1 Dec 1, 2022
Quick & dirty controller to schedule Kubernetes Jobs later (once)

K8s Jobber Operator Quickly implemented Kubernetes controller to enable scheduling of Jobs at a later time. Usage: To schedule a Job later, Set .spec.

Jukka Väisänen 2 Feb 11, 2022
Copy a Kubernetes pod and run commands in its environment

copypod Utility for copying a running Kubernetes pod so you can run commands in a copy of its environment, without worrying about it the pod potential

Memrise 4 Apr 8, 2022
Autoscaling volumes for Kubernetes (with the help of Prometheus)

Kubernetes Volume Autoscaler (with Prometheus) This repository contains a service that automatically increases the size of a Persistent Volume Claim i

DevOps Nirvana 142 Dec 28, 2022
Kube kombu - Running kombu consumers with support of liveness probe for kubernetes

Setup and Running Kombu consumers Steps: Install python 3.9 or greater on your s

Anmol Porwal 5 Dec 10, 2022