renoki-co/php-k8s
PHP K8s is a Kubernetes client for PHP and Laravel. Manage pods, deployments, services, and custom resources with a fluent API for CRUD, scaling, logs, exec, and watches—no kubectl required.
Architecture fit. renoki-co/php-k8s fits a Laravel/PHP application that needs to treat Kubernetes as an integration target rather than a runtime: internal admin panels, tenant/namespace provisioning, CRD-backed configuration, batch jobs, support tooling, and CI/CD helpers. It is a poor fit for cluster-critical controllers, high-frequency reconciliation loops, or anything requiring native informer/watch semantics and tight latency budgets. PHP’s request/worker lifecycle and the package’s unofficial status make it best suited to bounded, idempotent operations against the Kubernetes API.
Integration feasibility. Composer installation and Laravel service-container integration are straightforward for a team already on modern PHP. The package’s advertised support for any authentication method, exec API, and CRDs is attractive, but feasibility depends on deployment realities: exec-based auth requires provider CLIs (aws, gcloud, kubelogin, etc.) inside the container, in-cluster service-account tokens need rotation handling, and client-certificate auth needs secret hygiene. The last release was April 2023, so compatibility must be proven against the current PHP, Laravel, and Kubernetes versions rather than assumed.
Technical risk. The main risks are maintenance staleness, Kubernetes API deprecation/version skew, and auth complexity. An unofficial client with 326 stars has limited community redundancy and no vendor SLA. CRD support is useful but often dynamically typed, which pushes schema validation and error handling back onto our code. Exec API support is powerful but operationally sensitive: it expands the blast radius of compromised application credentials and depends on external binaries. Apache-2.0 licensing is acceptable and permits a fork if needed.
Key questions.
TPM recommendation. Proceed to a time-boxed spike for internal, non-critical automation and CRD management. Do not adopt for control-plane-critical workflows without a named owner, a version-support matrix, and a fork/exit plan.
Stack fit. Wrap the package behind an internal KubernetesClient interface rather than injecting it throughout controllers. Use Laravel commands and queue jobs for mutating operations, configuration for cluster/context selection, and DTOs for CRD payloads. Keep Kubernetes credentials in a dedicated service or least-privilege service account. Fits well for namespace provisioning, CRD-backed feature flags/tenant config, job orchestration, and support-facing pod exec; fits poorly for PHP-FPM request paths that need long-lived watches.
Migration path. Inventory existing kubectl shell-outs, direct Guzzle calls, and CI scripts. Replace read-only operations first (get, list) behind the interface, then CRD create/update, then exec. Preserve a fallback path to kubectl or Helm for emergency operations until the package proves stable. Avoid a big-bang migration; each operation should have contract tests against a disposable cluster.
Compatibility. Pin the package, PHP, Laravel, and Kubernetes versions explicitly. Build a compatibility matrix and test against kind/k3d clusters at the oldest and newest supported Kubernetes versions. Validate API group/version availability, CRD schema handling, exec-plugin availability in the runtime image, and TLS/CA rotation behavior. Prefer token or in-cluster auth over exec plugins where possible to reduce container dependencies.
Sequencing.
Maintenance. The package’s release cadence is low and community-only. Expect to own dependency updates, Kubernetes API compatibility testing, and possibly a fork. Apache-2.0 makes a fork legally viable, but it is still engineering cost. Assign a clear owner and track CVEs in PHP dependencies and Kubernetes client behavior.
Support. Support is GitHub-issue-based with no vendor escalation. Internal documentation, runbooks, and a fork/contribution policy are required. Teams unfamiliar with Kubernetes auth and RBAC will need guardrails; the package reduces API boilerplate but does not remove Kubernetes operational knowledge.
Scaling. Each PHP worker creates its own client and credentials context, so API-server QPS limits, 429 responses, and connection overhead matter. Batch and queue operations with backoff; avoid per-request client creation in hot paths. Long-running exec sessions tie up workers and should run in dedicated queue workers with timeouts. Watch-based patterns are a poor fit for PHP-FPM; prefer polling or event queues where possible.
Failure modes. Common failures include expired tokens or missing exec binaries, TLS/CA rotation, Kubernetes API version skew, RBAC denials, rate limiting, CRD schema drift, webhook timeouts, and partial failures without transactional semantics. Exec sessions can hang or leak. Design operations to be idempotent, observable, and retryable, with explicit timeouts and audit logs.
Ramp-up. A Laravel developer can complete basic reads/writes in days, but production readiness requires Kubernetes fundamentals, auth/RBAC, CRD schema handling, and failure-mode testing. Estimate one to two weeks for a spike and four to six weeks for hardened production use, including security review and runbooks.
How can I help you explore Laravel packages today?