PHP K8s is a PHP handler for the Kubernetes Cluster API, helping you handling the individual Kubernetes resources directly from PHP, like viewing, creating, updating or deleting resources.
For Laravel projects, you might want to use renoki-co/laravel-php-k8s which eases the access.
Renoki Co. on GitHub aims on bringing a lot of open source projects and helpful projects to the world. Developing and maintaining projects everyday is a harsh work and tho, we love it.
If you are using your application in your day-to-day job, on presentation demos, hobby projects or even school projects, spread some kind words about our work or sponsor our work. Kind words will touch our chakras and vibe, while the sponsorships will keep the open source projects alive.
You can install the package via composer:
composer require renoki-co/php-k8s
Having the following YAML configuratin for your Service kind:
apiVersion: v1
kind: Service
metadata:
name: nginx
namespace: frontend
spec:
selector:
app: frontend
ports:
- protocol: TCP
port: 80
targetPort: 80
Can be written like this:
use RenokiCo\PhpK8s\KubernetesCluster;
// Create a new instance of KubernetesCluster
$cluster = new KubernetesCluster('http://127.0.0.1:8080');
// Create a new NGINX service.
$svc = $cluster->service()
->setName('nginx')
->setNamespace('frontend')
->setSelectors(['app' => 'frontend'])
->setPorts([
['protocol' => 'TCP', 'port' => 80, 'targetPort' => 80],
])
->create();
Please refer to the Resources docs extensive documentation and the PR List to know what's up for development. Below you will find the list of supported resources for a quick and easy access.
Resource | Default Version |
---|---|
ClusterRole | rbac.authorization.k8s.io/v1 |
ClusterRoleBinding | rbac.authorization.k8s.io/v1 |
ConfigMap | v1 |
CronJob | batch/v1beta1 |
DaemonSet | apps/v1 |
Deployment | apps/v1 |
HorizontalPodAutoscaler | autoscaling/v2beta2 |
Ingress | networking.k8s.io/v1beta1 |
Job | batch/v1 |
Namespace | v1 |
Node | v1 |
PersistenVolume | v1 |
PersistenVolumeClaim | v1 |
Pod | v1 |
Role | rbac.authorization.k8s.io/v1 |
RoleBinding | rbac.authorization.k8s.io/v1 |
Secret | v1 |
Service | v1 |
ServiceAccount | v1 |
StatefulSet | apps/v1 |
StorageClass | storage.k8s.io/v1 |
vendor/bin/phpunit
Please see CONTRIBUTING for details.
If you discover any security related issues, please email alex@renoki.org instead of using the issue tracker.