Walk through deploying a Laravel application on auto scaled Kubernetes cluster.
Goal: Deploy PHP app that will auto scale based on average CPU utilization across deployed instance.
composer global require "laravel/installer"
composer create-project --prefer-dist laravel/laravel laravel-project
For the purpose of this demo I've built a public docker image and pushed to my Docker account. Dockerfile
adds laravel app into a lightweight alpine image.
docker build -t crunchgeek/laravel-project .
docker push crunchgeek/laravel-project
kubectl create -f env-app.yaml
kubectl create -f env-php.yaml
kubectl create -f env-nginx.yaml
kubectl create -f deployment.yaml
this step requires a different service yaml
depending where the app is being deployed:
kubectl create -f service.node.yaml
minikube service laravel-project
kubectl create -f service.yaml
kubectl create -f service.aws.yaml
kubectl create -f autoscaler.yaml
That's it! Now the infrastructure will auto adjust itself to the app resources demand.