https://github.com/firehed/php-kubesdk
PHP Kubernetes SDK
https://github.com/firehed/php-kubesdk
Last synced: about 1 year ago
JSON representation
PHP Kubernetes SDK
- Host: GitHub
- URL: https://github.com/firehed/php-kubesdk
- Owner: Firehed
- Created: 2018-10-03T17:26:35.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-12-18T20:41:13.000Z (over 7 years ago)
- Last Synced: 2025-02-13T22:26:59.835Z (over 1 year ago)
- Language: PHP
- Size: 9.77 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Kubernetes SDK
[](https://travis-ci.org/Firehed/php-kubesdk)
[](https://codecov.io/gh/Firehed/php-kubesdk)
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 the `kubectl 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 the `serviceAccountName` configuration of the pod.
You will probably want to determine which one to load approximately like this:
```php
// ... 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`](src/Api.php) interface.
Network timeouts default to 500ms on connect and 3000ms for the request.