5 ms·
Why not just use the official python kubernetes client? https://github.com/kubernetes-client/python https://github.com/kubernetes-client/python
by usrk0123961 3y ago
Why not just use the official python kubernetes client?
https://github.com/kubernetes-client/python https://github.com/kubernetes-client/python
- jacobtomlinson 3y agoI built kr8s because the official autogenerated library is extremely verbose, low level and hard to use. Kr8s is modelled after kubectl instead of the REST API to try and be more accessible to developers.
- alpb 3y agoThese low-level constructs in the client libraries exist so that people can build controllers and operators on top of it, no? There's a lot that goes into making of implementing a Kubernetes client such as keeping up with semantic changes (dry run, server-side apply, tracing, rate limiting, patch support etc). Does your library also cover these?
- jacobtomlinson 3y agoAnything you can do with the official library you can do with kr8s. Some things will require writing low level HTTP requests if we haven’t implemented them yet, but it’s not so different to the official low level auto generated API. The goal here is to make easy things easy, while ensuring anything is possible.
- galenmarchetti 3y agoseconding the answer given by OP...I've also found the raw clients very low level and hard to use. I appreciate the higher level abstraction here, emphasis on "batteries included" and usability mirroring kubectl
- dharmab 3y agoThe official python client does not have feature parity with kubectl; I had to reimplement parts of kubectl in my own scripts, like the 'apply' and 'exec' subcommands and less-flaky CRD deployments.
- jacobtomlinson 3y agoKr8s already has things like port forwarding and I’m working on apply right now. Exec is next on my list
- dharmab 3y agohere, take my code: https://github.com/dharmab/homelab-k3s/blob/2f46393aeeb736736595ed830c259c7888a2a3e0/lab/main.py#L96 https://github.com/dharmab/homelab-k3s/blob/2f46393aeeb73673...
- jacobtomlinson 3y agoHeh thanks. We are trying to avoid binary dependencies like kubectl because you can’t install the with pip.
- dharmab 3y agothat exec function is pure python, and the order of operations in that deploy function is important (initial deployment of resource out of order will likely either fail outright or cause certain Pods to fail to become read)