zalando-kubectl


Namezalando-kubectl JSON
Version 1.33.4.256 PyPI version JSON
download
home_pageNone
SummaryKubectl wrapper in Python with OAuth token auth
upload_time2025-09-10 07:43:30
maintainerNone
docs_urlNone
authorTeam Teapot
requires_pythonNone
licenseApache License 2.0
keywords kubectl kubernetes
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ===============
Zalando Kubectl
===============

.. image:: https://img.shields.io/pypi/dw/zalando-kubectl.svg
   :target: https://pypi.python.org/pypi/zalando-kubectl/
   :alt: PyPI Downloads

.. image:: https://img.shields.io/pypi/v/zalando-kubectl.svg
   :target: https://pypi.python.org/pypi/zalando-kubectl/
   :alt: Latest PyPI version

.. image:: https://img.shields.io/pypi/l/zalando-kubectl.svg
   :target: https://pypi.python.org/pypi/zalando-kubectl/
   :alt: License

Kubernetes CLI (kubectl) wrapper in Python with OAuth token authentication.

This wrapper script ``zkubectl`` serves as a drop-in replacement for the ``kubectl`` binary:

* it downloads the current ``kubectl`` binary from Google
* it generates a new ``~/.kube/config`` with an OAuth Bearer token acquired via `zign`_.
* it passes through commands to the ``kubectl`` binary


Installation
============

Requires Python 3.6+.

.. code-block:: bash

    $ sudo pip3 install --upgrade zalando-kubectl

Usage
=====

You can directly login to a known Kubernetes API server endpoint:

.. code-block:: bash

    $ zkubectl login https://my-api-server.example.org
    $ zkubectl cluster-info

You can also configure a Cluster Registry to look up clusters by ID:

.. code-block:: bash

    $ zkubectl configure --cluster-registry=https://cluster-registry.example.org
    $ zkubectl login my-cluster-id

The Cluster Registry needs to provide the following HTTP API for this to work:

.. code-block:: bash

    $ curl -H "Authorization: Bearer $(zign tok)" https://cluster-registry.example.org/kubernetes-clusters/my-cluster-id
    {
        "api_server_url": "https://my-api-server.example.org"
    }

There is an additional convenience command to open the `kube-web-view` dashboard in the browser:

.. code-block:: bash

    $ zkubectl dashboard
    Opening https://kube-web-view.zalando.net/ ..


Unit Tests
==========

Run unit tests with Tox:

.. code-block:: bash

    $ sudo pip3 install tox
    $ tox

Local Changes
=============

It's recommended to have a `virtualenv` for the project. The project uses `Black`_ for code formatting,
please configure your editor to use it.

Go to the project dir and install dependencies into virtual test environment

.. code-block:: bash

    $ cd <project-path>
    # create new virtual environment if not yet
    $ python -m venv test_environment
    # enter virtual environment
    $ source ./test_environment/bin/activate
    # check pip is executed fron this virtual environment
    (test_environment) $ which pip
    <project-path>/test_environment/bin/pip

    (test_environment) $ pip install -r requirements.txt
    (test_environment) $ pip install --editable .

Now the code change will just be reflected in the `zkubectl` binary

.. code-block:: bash

    (test_environment) $ zkubectl <whatever>

As an alternative for creating an environment you can run local changes from `zalando_kubectl`

.. code-block:: bash

    $ cd <project-path>
    $ python -m zalando_kubectl <whatever>

.. _zign: https://pypi.python.org/pypi/stups-zign
.. _Kubernetes Dashboard web UI: http://kubernetes.io/docs/user-guide/ui/
.. _Black: https://black.readthedocs.io/en/stable/

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "zalando-kubectl",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "kubectl kubernetes",
    "author": "Team Teapot",
    "author_email": "team-teapot@zalando.de",
    "download_url": "https://files.pythonhosted.org/packages/3b/35/caac5885891e780faef030bdb6f43c3ae19f2cb412e0d0a993dd7f619365/zalando_kubectl-1.33.4.256.tar.gz",
    "platform": null,
    "description": "===============\nZalando Kubectl\n===============\n\n.. image:: https://img.shields.io/pypi/dw/zalando-kubectl.svg\n   :target: https://pypi.python.org/pypi/zalando-kubectl/\n   :alt: PyPI Downloads\n\n.. image:: https://img.shields.io/pypi/v/zalando-kubectl.svg\n   :target: https://pypi.python.org/pypi/zalando-kubectl/\n   :alt: Latest PyPI version\n\n.. image:: https://img.shields.io/pypi/l/zalando-kubectl.svg\n   :target: https://pypi.python.org/pypi/zalando-kubectl/\n   :alt: License\n\nKubernetes CLI (kubectl) wrapper in Python with OAuth token authentication.\n\nThis wrapper script ``zkubectl`` serves as a drop-in replacement for the ``kubectl`` binary:\n\n* it downloads the current ``kubectl`` binary from Google\n* it generates a new ``~/.kube/config`` with an OAuth Bearer token acquired via `zign`_.\n* it passes through commands to the ``kubectl`` binary\n\n\nInstallation\n============\n\nRequires Python 3.6+.\n\n.. code-block:: bash\n\n    $ sudo pip3 install --upgrade zalando-kubectl\n\nUsage\n=====\n\nYou can directly login to a known Kubernetes API server endpoint:\n\n.. code-block:: bash\n\n    $ zkubectl login https://my-api-server.example.org\n    $ zkubectl cluster-info\n\nYou can also configure a Cluster Registry to look up clusters by ID:\n\n.. code-block:: bash\n\n    $ zkubectl configure --cluster-registry=https://cluster-registry.example.org\n    $ zkubectl login my-cluster-id\n\nThe Cluster Registry needs to provide the following HTTP API for this to work:\n\n.. code-block:: bash\n\n    $ curl -H \"Authorization: Bearer $(zign tok)\" https://cluster-registry.example.org/kubernetes-clusters/my-cluster-id\n    {\n        \"api_server_url\": \"https://my-api-server.example.org\"\n    }\n\nThere is an additional convenience command to open the `kube-web-view` dashboard in the browser:\n\n.. code-block:: bash\n\n    $ zkubectl dashboard\n    Opening https://kube-web-view.zalando.net/ ..\n\n\nUnit Tests\n==========\n\nRun unit tests with Tox:\n\n.. code-block:: bash\n\n    $ sudo pip3 install tox\n    $ tox\n\nLocal Changes\n=============\n\nIt's recommended to have a `virtualenv` for the project. The project uses `Black`_ for code formatting,\nplease configure your editor to use it.\n\nGo to the project dir and install dependencies into virtual test environment\n\n.. code-block:: bash\n\n    $ cd <project-path>\n    # create new virtual environment if not yet\n    $ python -m venv test_environment\n    # enter virtual environment\n    $ source ./test_environment/bin/activate\n    # check pip is executed fron this virtual environment\n    (test_environment) $ which pip\n    <project-path>/test_environment/bin/pip\n\n    (test_environment) $ pip install -r requirements.txt\n    (test_environment) $ pip install --editable .\n\nNow the code change will just be reflected in the `zkubectl` binary\n\n.. code-block:: bash\n\n    (test_environment) $ zkubectl <whatever>\n\nAs an alternative for creating an environment you can run local changes from `zalando_kubectl`\n\n.. code-block:: bash\n\n    $ cd <project-path>\n    $ python -m zalando_kubectl <whatever>\n\n.. _zign: https://pypi.python.org/pypi/stups-zign\n.. _Kubernetes Dashboard web UI: http://kubernetes.io/docs/user-guide/ui/\n.. _Black: https://black.readthedocs.io/en/stable/\n",
    "bugtrack_url": null,
    "license": "Apache License 2.0",
    "summary": "Kubectl wrapper in Python with OAuth token auth",
    "version": "1.33.4.256",
    "project_urls": null,
    "split_keywords": [
        "kubectl",
        "kubernetes"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "8c75b4c77283150b0e290503798e21f4f7ff1f0c6e0a6381cb013b1004d48460",
                "md5": "c8d9d15643c3cb47cd7f9583f9c8fd74",
                "sha256": "be3240cff77da6ca7a2805d2138a76b43b78ff5da1609c5e7f24574221b6cb3d"
            },
            "downloads": -1,
            "filename": "zalando_kubectl-1.33.4.256-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c8d9d15643c3cb47cd7f9583f9c8fd74",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 53400,
            "upload_time": "2025-09-10T07:43:29",
            "upload_time_iso_8601": "2025-09-10T07:43:29.211242Z",
            "url": "https://files.pythonhosted.org/packages/8c/75/b4c77283150b0e290503798e21f4f7ff1f0c6e0a6381cb013b1004d48460/zalando_kubectl-1.33.4.256-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "3b35caac5885891e780faef030bdb6f43c3ae19f2cb412e0d0a993dd7f619365",
                "md5": "df6c05c7036f1d8adf98631cfe34d190",
                "sha256": "a50043a2d90d313d50f65079e34ebfdeda84db8ad1c63ad71e7e8d4c9dbf21a9"
            },
            "downloads": -1,
            "filename": "zalando_kubectl-1.33.4.256.tar.gz",
            "has_sig": false,
            "md5_digest": "df6c05c7036f1d8adf98631cfe34d190",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 50728,
            "upload_time": "2025-09-10T07:43:30",
            "upload_time_iso_8601": "2025-09-10T07:43:30.754090Z",
            "url": "https://files.pythonhosted.org/packages/3b/35/caac5885891e780faef030bdb6f43c3ae19f2cb412e0d0a993dd7f619365/zalando_kubectl-1.33.4.256.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-09-10 07:43:30",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "zalando-kubectl"
}
        
Elapsed time: 2.55001s