{"id":13617014,"url":"https://github.com/kelproject/pykube","last_synced_at":"2025-04-14T03:32:24.311Z","repository":{"id":35471947,"uuid":"39740335","full_name":"kelproject/pykube","owner":"kelproject","description":"Python client library for Kubernetes","archived":true,"fork":false,"pushed_at":"2018-09-12T04:33:53.000Z","size":252,"stargazers_count":349,"open_issues_count":55,"forks_count":183,"subscribers_count":15,"default_branch":"master","last_synced_at":"2024-11-08T01:37:50.644Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kelproject.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-26T20:14:28.000Z","updated_at":"2024-04-22T16:11:46.000Z","dependencies_parsed_at":"2022-09-12T23:50:15.845Z","dependency_job_id":null,"html_url":"https://github.com/kelproject/pykube","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kelproject%2Fpykube","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kelproject%2Fpykube/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kelproject%2Fpykube/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kelproject%2Fpykube/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kelproject","download_url":"https://codeload.github.com/kelproject/pykube/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248815648,"owners_count":21165959,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T20:01:35.906Z","updated_at":"2025-04-14T03:32:19.301Z","avatar_url":"https://github.com/kelproject.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"pykube\n======\n\n.. image:: http://slack.kelproject.com/badge.svg\n   :target: http://slack.kelproject.com/\n\n.. image:: https://img.shields.io/travis/kelproject/pykube.svg\n   :target: https://travis-ci.org/kelproject/pykube\n\n.. image:: https://img.shields.io/pypi/dm/pykube.svg\n   :target:  https://pypi.python.org/pypi/pykube/\n\n.. image:: https://img.shields.io/pypi/v/pykube.svg\n   :target:  https://pypi.python.org/pypi/pykube/\n\n.. image:: https://img.shields.io/badge/license-apache-blue.svg\n   :target:  https://pypi.python.org/pypi/pykube/\n\nPython client library for Kubernetes\n\n.. image:: https://storage.googleapis.com/kel-assets/kel_full-02_200.jpg\n   :target: http://kelproject.com/\n\nKel is an open source Platform as a Service (PaaS) from Eldarion, Inc. that\nmakes it easy to manage web application deployment and hosting through the\nentire lifecycle from development through testing to production. It adds\ncomponents and tools on top of Kubernetes that help developers manage their\napplication infrastructure. Kel builds on Eldarion's 7+ years experience running\none of the leading Python and Django PaaSes.\n\nFor more information about Kel, see `kelproject.com`_, follow us on Twitter\n`@projectkel`_, and join our `Slack team`_.\n\n.. _kelproject.com: http://kelproject.com/\n.. _@projectkel: https://twitter.com/projectkel\n.. _Slack team: http://slack.kelproject.com/\n\nFeatures\n--------\n\n* HTTP interface using requests using kubeconfig for authentication\n* Python native querying of Kubernetes API objects\n\nInstallation\n------------\n\nTo install pykube, use pip::\n\n    pip install pykube\n\nUsage\n-----\n\nQuery for all ready pods in a custom namespace:\n\n.. code:: python\n\n    import operator\n    import pykube\n\n    api = pykube.HTTPClient(pykube.KubeConfig.from_file(\"/Users/\u003cusername\u003e/.kube/config\"))\n    pods = pykube.Pod.objects(api).filter(namespace=\"gondor-system\")\n    ready_pods = filter(operator.attrgetter(\"ready\"), pods)\n\nAccess any attribute of the Kubernetes object:\n\n.. code:: python\n\n    pod = pykube.Pod.objects(api).filter(namespace=\"gondor-system\").get(name=\"my-pod\")\n    pod.obj[\"spec\"][\"containers\"][0][\"image\"]\n\nSelector query:\n\n.. code:: python\n\n    pods = pykube.Pod.objects(api).filter(\n        namespace=\"gondor-system\",\n        selector={\"gondor.io/name__in\": {\"api-web\", \"api-worker\"}},\n    )\n    pending_pods = pykube.objects.Pod.objects(api).filter(\n        field_selector={\"status.phase\": \"Pending\"}\n    )\n\nWatch query:\n\n.. code:: python\n\n    watch = pykube.Job.objects(api, namespace=\"gondor-system\")\n    watch = watch.filter(field_selector={\"metadata.name\": \"my-job\"}).watch()\n\n    # watch is a generator:\n    for watch_event in watch:\n        print(watch_event.type) # 'ADDED', 'DELETED', 'MODIFIED'\n        print(watch_event.object) # pykube.Job object\n\nCreate a ReplicationController:\n\n.. code:: python\n\n    obj = {\n        \"apiVersion\": \"v1\",\n        \"kind\": \"ReplicationController\",\n        \"metadata\": {\n            \"name\": \"my-rc\",\n            \"namespace\": \"gondor-system\"\n        },\n        \"spec\": {\n            \"replicas\": 3,\n            \"selector\": {\n                \"app\": \"nginx\"\n            },\n            \"template\": {\n                \"metadata\": {\n                    \"labels\": {\n                        \"app\": \"nginx\"\n                    }\n                },\n                \"spec\": {\n                    \"containers\": [\n                        {\n                            \"name\": \"nginx\",\n                            \"image\": \"nginx\",\n                            \"ports\": [\n                                {\"containerPort\": 80}\n                            ]\n                        }\n                    ]\n                }\n            }\n        }\n    }\n    pykube.ReplicationController(api, obj).create()\n\nDelete a ReplicationController:\n\n.. code:: python\n\n    obj = {\n        \"apiVersion\": \"v1\",\n        \"kind\": \"ReplicationController\",\n        \"metadata\": {\n            \"name\": \"my-rc\",\n            \"namespace\": \"gondor-system\"\n        }\n    }\n    pykube.ReplicationController(api, obj).delete()\n\nCheck server version:\n\n.. code:: python\n\n    api = pykube.HTTPClient(pykube.KubeConfig.from_file(\"/Users/\u003cusername\u003e/.kube/config\"))\n    api.version\n\nHTTPie\n------\n\npykube can be used together with HTTPie for Kubernetes command line querying goodness. For example:\n\n.. code:: shell\n\n    pip install httpie\n    http pykube://minikube/api/v1/services\n\nThe above example will construct an HTTP request to the cluster behind the ``minikube`` context and\nshow you the response containing all services.\n\nRequirements\n------------\n\n* Python 2.7 or 3.3+\n* requests (included in ``install_requires``)\n* PyYAML (included in ``install_requires``)\n\nLicense\n-------\n\nThe code in this project is licensed under the Apache License, version 2.0\n(included in this repository under LICENSE).\n\n\nContributing\n------------\n\nBy making a contribution to this project, you are agreeing to the `Developer\nCertificate of Origin v1.1`_ (also included in this repository under DCO.txt).\n\n.. _Developer Certificate of Origin v1.1: http://developercertificate.org\n\n\nCode of Conduct\n----------------\n\nIn order to foster a kind, inclusive, and harassment-free community, the Kel\nProject follows the `Contributor Covenant Code of Conduct`_.\n\n.. _Contributor Covenant Code of Conduct: http://contributor-covenant.org/version/1/4/\n\n\nCommercial Support\n------------------\n\nCommercial support for Kel is available through Eldarion, please contact\ninfo@eldarion.com.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkelproject%2Fpykube","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkelproject%2Fpykube","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkelproject%2Fpykube/lists"}