firehed / kube-sdk
SDK for interacting with the Kubernetes API
1.1.0
2018-12-18 20:36 UTC
Requires
- php: ^7.1
- ext-curl: *
Requires (Dev)
- phpstan/phpstan: ^0.10
- phpstan/phpstan-phpunit: ^0.10
- phpunit/phpunit: ^7.0
- squizlabs/php_codesniffer: ^3.2
This package is auto-updated.
Last update: 2024-10-19 10:44:10 UTC
README
A simple API wrapper for interacting with the Kubernetes API
Usage
There are two classes to interface with the Kubernetes API:
Kubernetes\LocalProxy
is for use on your local machine, or anywhere else thekubectl proxy
command may be running.Kubernetes\ServiceAccount
is for use inside of Kubernetes. It will auto-detect the auth information automatically configured in all Pods. This will respect theserviceAccountName
configuration of the pod.
You will probably want to determine which one to load approximately like this:
// ... PSR-11 container definition Kubernetes\Api::class => function () { if (getenv('KUBERNETES_SERVICE_HOST')) { return new Kubernetes\ServiceAccount(); } else { return new Kubernetes\LocalProxy('http://localhost:8001'); } },
The SDK methods are defined in the Kubernetes\Api
interface.
Network timeouts default to 500ms on connect and 3000ms for the request.