dealroadshow/k8s-resources
Laravel package for defining and managing Kubernetes resource manifests (e.g., Deployments, Services, Ingress) in PHP. Helps generate, organize, and deploy K8s YAML from your app with reusable resource classes and configuration.
Deployment, Service, Ingress), making it ideal for Kubernetes-native PHP applications (e.g., microservices, CI/CD tooling, or Kubernetes-aware orchestration layers).
kubernetes-client-php). Useful for:
kubernetes-client-php), but assumes familiarity with Kubernetes API structure.symfony/yaml for manifest generation.guzzlehttp/guzzle for API calls (if extending functionality).dealroadshow/k8s-resources complements, but doesn’t replace, Kubernetes SDKs.| Risk Area | Assessment | Mitigation Strategy |
|---|---|---|
| Kubernetes Version Drift | Resources may lag behind latest Kubernetes API versions. | Pin to a stable Kubernetes version; monitor upstream for updates. |
| Limited High-Level Abstraction | No built-in client for applying/patching resources (unlike kubernetes-client-php). |
Integrate with kubernetes-client-php or use Guzzle for HTTP operations. |
| YAML Generation Complexity | Manual YAML rendering may be error-prone. | Use symfony/yaml or a templating engine (e.g., Blade) for safer serialization. |
| Laravel-Specific Gaps | No native Laravel service provider or Artisan commands. | Build wrappers (e.g., php artisan k8s:deploy) or use Laravel’s package auto-discovery. |
Why PHP for Kubernetes?
kubectl CLI) suffice instead?Resource Scope
Deployment, Service, Ingress first.)Deployment Workflow
kubectl/Helm, or augment it (e.g., dynamic manifest generation)?kubectl calls, direct API, or a custom controller)?Team Expertise
Long-Term Maintenance
K8sServiceProvider).| Component | Purpose | Example Package |
|---|---|---|
| YAML Handling | Serialize/deserialize resources to YAML. | symfony/yaml |
| HTTP Client | Apply/patch resources via Kubernetes API. | guzzlehttp/guzzle or kubernetes-client-php |
| Templating | Dynamic manifest generation (e.g., Helm-like templating). | twig/twig or Laravel Blade |
| Testing | Mock Kubernetes resources in PHPUnit. | mockery/mockery + custom stubs |
Phase 1: Proof of Concept (PoC)
composer require dealroadshow/k8s-resources.Deployment resource in PHP and export to YAML.kubectl apply -f generated.yaml.Phase 2: Core Integration
k8s:deploy, k8s:validate).FormRequest for resource schemas).// app/Providers/K8sServiceProvider.php
public function register()
{
$this->app->singleton(Deployment::class, fn() => new Deployment());
}
Phase 3: Advanced Use Cases
// app/Console/Commands/K8sDeploy.php
public function handle()
{
$deployment = new Deployment();
$deployment->setImage('nginx:latest');
$yaml = Yaml::dump([$deployment], 10, 2);
shell_exec("kubectl apply -f - <<< '$yaml'");
}
v1.26) to avoid drift.^9.0 or ^10.0 to composer.json constraints.| Priority | Task | Dependencies |
|---|---|---|
| 1 | Install package and validate basic resource generation. | None |
| 2 | Integrate with Laravel’s service container. | Phase 1 success |
| 3 | Build Artisan commands for common workflows. | Laravel service provider |
| 4 | Add validation (e.g., Laravel FormRequest for resource schemas). | Phase 2 |
| 5 | Extend for dynamic use cases (e.g., webhooks, controllers). | Phase 3 |
| 6 | Document and train team on Kubernetes API + PHP usage. | All phases |
dealroadshow/k8s-resources for Kubernetes API updates.composer.json replace or fork if upstream changes break custom logic.README.md or internal wiki.kubectl explain for schemaHow can I help you explore Laravel packages today?