alicfeng / kubernetes-client
Kubernetes PHP Client
v1.3.1
2021-05-06 02:58 UTC
Requires
- php: ^7.1|^8.0
- ext-curl: *
- ext-gd: *
- ext-json: *
- ext-openssl: *
- guzzlehttp/guzzle: 7.2.0
- symfony/yaml: ^5.2
Requires (Dev)
- composer/composer: ^1.8
- friendsofphp/php-cs-fixer: ^2.18
- orchestra/testbench: ^3.5
- phpunit/phpunit: @stable
README
KubernetesClient
A PHP Client For Manage Kubernetes Cluster
Based on official of Kubernetes interface as well as dependent GuzzleHttp to generate.
🚀 Quick start
standard
composer require alicfeng/kubernetes-client -vvv
Laravel
php artisan vendor:publish --provider="AlicFeng\Kubernetes\ServiceProvider\AsmServiceProvider" php artisan vendor:publish --provider="AlicFeng\Kubernetes\ServiceProvider\KubernetesServiceProvider" # OR php artisan vendor:publish --tag=kubernetes php artisan vendor:publish --tag=asm
✨ Features
-
Service
-
Deployment
-
Pod
-
Job
-
ConfigMap
-
DaemonSet
-
Node
-
Secrets
-
StatefulSet
-
Event
-
PersistentVolumeClaim
-
Ingress
-
ReplicationController
-
GagaWay
-
VirtualService
☛ Usage
Authorization support three method including token,username & password as well as cert file
use AlicFeng\Kubernetes\Kubernetes; $config = [ 'base_uri' => 'https://127.0.0.1:6443', 'token' => 'token', 'namespace' => 'default' ]; $service = Kubernetes::service($config); $metadata = [ 'name' => 'demo-service' ]; $spec = [ 'type' => 'NodePort', 'selector' => [ 'k8s-app' => 'demo-service', ], 'ports' => [ [ 'protocol' => 'TCP', 'port' => 80, 'targetPort' => 80, 'nodePort' => 30008 ] ] ]; # Create Service $service->setMetadata($metadata)->setSpec($spec)->create(); # Patch Service $service->apply('name'); # Delete Service $service->delete('name'); # Service Exist $service->list()->exist('name'); # Item Service $service->list()->item('name');
💖 Thanks developer
₤ Kubernetes
See the API documentation for an explanation of the options:
https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/