kr8s-0.9.2
0.9.2
0.9.1
0.9.0
0.8.9
0.8.8
0.8.7
0.8.6
0.8.5
0.8.4
0.8.3
0.8.20
0.8.2
0.8.19
0.8.18
0.8.17
0.8.16
0.8.15
0.8.13
0.8.12
0.8.11
0.8.10
0.8.1
0.8.0
0.7.0
0.6.0
0.5.2
0.5.1
0.5.0
0.4.1
0.4.0
0.3.0
0.20.9
0.20.8
0.20.7
0.20.6
0.20.5
0.20.4
0.20.3
0.20.2
0.20.15
0.20.14
0.20.13
0.20.12
0.20.11
0.20.10
0.20.1
0.20.0
0.2.0
0.19.1
0.19.0
0.18.1
0.18.0
0.17.4
0.17.3
0.17.2
0.17.1
0.17.0
0.16.2
0.16.1
0.16.0
0.15.0
0.14.6
0.14.5
0.14.4
0.14.3
0.14.2
0.14.1
0.14.0
0.13.6
0.13.5
0.13.4
0.13.3
0.13.2
0.13.1
0.13.0
0.12.9
0.12.8
0.12.7
0.12.6
0.12.5
0.12.4
0.12.3
0.12.2
0.12.15
0.12.14
0.12.13
0.12.12
0.12.11
0.12.10
0.12.1
0.12.0
0.11.0
0.10.0
0.1.0a0
0.1.0
0.9.2
0.9.1
0.9.0
0.8.9
0.8.8
0.8.7
0.8.6
0.8.5
0.8.4
0.8.3
0.8.20
0.8.2
0.8.19
0.8.18
0.8.17
0.8.16
0.8.15
0.8.13
0.8.12
0.8.11
0.8.10
0.8.1
0.8.0
0.7.0
0.6.0
0.5.2
0.5.1
0.5.0
0.4.1
0.4.0
0.3.0
0.20.9
0.20.8
0.20.7
0.20.6
0.20.5
0.20.4
0.20.3
0.20.2
0.20.15
0.20.14
0.20.13
0.20.12
0.20.11
0.20.10
0.20.1
0.20.0
0.2.0
0.19.1
0.19.0
0.18.1
0.18.0
0.17.4
0.17.3
0.17.2
0.17.1
0.17.0
0.16.2
0.16.1
0.16.0
0.15.0
0.14.6
0.14.5
0.14.4
0.14.3
0.14.2
0.14.1
0.14.0
0.13.6
0.13.5
0.13.4
0.13.3
0.13.2
0.13.1
0.13.0
0.12.9
0.12.8
0.12.7
0.12.6
0.12.5
0.12.4
0.12.3
0.12.2
0.12.15
0.12.14
0.12.13
0.12.12
0.12.11
0.12.10
0.12.1
0.12.0
0.11.0
0.10.0
0.1.0a0
0.1.0
توضیحات
A Kubernetes API library
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | kr8s-0.9.2 |
| نام | kr8s |
| نسخه کتابخانه | 0.9.2 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | - |
| ایمیل نویسنده | Jacob Tomlimson <jacob@tomlinson.email> |
| آدرس صفحه اصلی | - |
| آدرس اینترنتی | https://pypi.org/project/kr8s/ |
| مجوز | BSD-3-Clause |
<div style="text-align: center; width: 100%;"><img src="https://github.com/kr8s-org/kr8s/raw/v0.17.2/branding/logo-wide.png" style="max-height: 200px;" /></div>
[](https://github.com/kr8s-org/kr8s/actions/workflows/test.yaml)
[](https://app.codecov.io/gh/kr8s-org/kr8s)
[](https://results.pre-commit.ci/latest/github/kr8s-org/kr8s/main)
[](https://docs.kr8s.org/en/stable/)
[](https://jacobtomlinson.dev/effver)
[](https://pypi.org/project/kr8s/)
[](https://pypi.org/project/kr8s/)
[](https://docs.kr8s.org/en/stable/installation.html#supported-kubernetes-versions)
[](https://pypi.org/project/kr8s/)
[](https://pypi.org/project/kr8s/)
A simple, extensible Python client library for Kubernetes that feels familiar for folks who already know how to use `kubectl`.
## Highlights
- API inspired by `kubectl` for a shallow learning curve.
- [Sensible defaults](https://docs.kr8s.org/en/stable/authentication.html) to reduce boiler plate.
- No swagger generated code, human readable code only.
- Has both a standard and an [async API](https://docs.kr8s.org/en/stable/asyncio.html) that can be used with `asyncio` and `trio`.
- [Client caching](https://docs.kr8s.org/en/stable/client.html#client-caching) to reduce passing API objects around.
- Batteries included by providing [useful utilities and methods](https://docs.kr8s.org/en/stable/examples/pod_operations.html) inspired by `kubectl`.
## Quickstart
### Installation
```console
$ pip install kr8s
```
## Examples
> [!TIP]
> See the [Examples Documentation](https://docs.kr8s.org/en/stable/examples/) for a full set of examples including `asyncio` examples.
### List Nodes
Print out all of the node names in the cluster.
```python
import kr8s
for node in kr8s.get("nodes"):
print(node.name)
```
### Create a Pod
Create a new Pod.
```python
from kr8s.objects import Pod
pod = Pod({
"apiVersion": "v1",
"kind": "Pod",
"metadata": {
"name": "my-pod",
},
"spec": {
"containers": [{"name": "pause", "image": "gcr.io/google_containers/pause",}]
},
})
pod.create()
```
### Scale a Deployment
Scale the Deployment `metrics-server` in the Namespace `kube-system` to `1` replica.
```python
from kr8s.objects import Deployment
deploy = Deployment.get("metrics-server", namespace="kube-system")
deploy.scale(1)
```
### List Pods by label selector
Get all Pods from all Namespaces matching a label selector.
```python
import kr8s
selector = {'component': 'kube-scheduler'}
for pod in kr8s.get("pods", namespace=kr8s.ALL, label_selector=selector):
print(pod.namespace, pod.name)
```
### Add a label to a Pod
Add the label `foo` with the value `bar` to an existing Pod.
```python
from kr8s.objects import Pod
pod = Pod("kube-apiserver", namespace="kube-system")
pod.label({"foo": "bar"})
```
### Generate a Pod
Generate a simple Pod with a couple of keyword arguments.
```python
from kr8s.objects import Pod
pod = Pod.gen(name="example-1", image="nginx:latest")
pod.create()
```
### Cordon a Node
Cordon a Node to mark it as unschedulable.
```python
from kr8s.objects import Node
node = Node("k8s-node-1")
node.cordon()
```
### Pod Exec
Exec a command in a Pod.
```python
from kr8s.objects import Pod
pod = Pod.get("my-pod")
command = pod.exec(["uptime"])
print(command.stdout.decode())
# 13:49:05 up 23:03, 0 users, load average: 0.66, 0.87, 0.85
```
### Port forward a Pod
Open a port forward to a Pod as a background task/thread.
```python
from kr8s.objects import Pod
pod = Pod.get("my-pod")
pf = pod.portforward(remote_port=1234, local_port=5678)
# Starts the port forward in a background thread
pf.start()
# Your other code goes here
# Optionally stop the port forward thread (it will exit with Python anyway)
pf.stop()
```
> [!TIP]
> See the [Examples Documentation](https://docs.kr8s.org/en/stable/examples/) for a full set of examples including `asyncio` examples.
نیازمندی
| مقدار | نام |
|---|---|
| - | anyio>=3.7.0 |
| - | cachetools>=5.2.0 |
| - | cryptography>=35 |
| ython_versio | exceptiongroup>=1.2.0; |
| - | httpx-ws>=0.7.0 |
| - | httpx>=0.24.1 |
| - | packaging>=23.0 |
| - | python-box>=7.0.1 |
| - | python-jsonpath>=0.7.1 |
| - | pyyaml>=6.0 |
| ython_versio | typing-extensions>=4.12.2; |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.9 | Python |
نحوه نصب
نصب پکیج whl kr8s-0.9.2:
pip install kr8s-0.9.2.whl
نصب پکیج tar.gz kr8s-0.9.2:
pip install kr8s-0.9.2.tar.gz