How to deploy Laravel with Docker on Kubernetes

Build and run the docker image from the project folder

git clone https://github.com/pietheinstrengholt/laravel-docker-k8s
docker-compose build
docker-compose up -d
http://localhost:8181/

Build the image and push to Docker Hub

docker build . -f ./deploy/dockerfile -t laravel-on-k8s:v1
docker login
docker tag laravel-on-k8s:v1 docker.io/pietheinstrengholt/laravel-on-k8s:v1
docker push docker.io/pietheinstrengholt/laravel-on-k8s:v1

Deploy the project using Kubernetes (Minikube)

minikube start
image: docker.io/pietheinstrengholt/laravel-docker-k8s:v1
kubectl apply -f deploy/app/secret.yml
kubectl apply -f deploy/app/deploy.yml
kubectl apply -f deploy/app/service.yml
minikube dashboard
http://192.168.99.100:30000/#!/overview?namespace=default
kubectl get service
NAME | TYPE | CLUSTER-IP | EXTERNAL-IP | PORT(S) | AGE
hello-minikube | NodePort | 10.98.64.133 | <none> | 8080:30271/TCP | 2d
kubernetes | ClusterIP | 10.96.0.1 | <none> | 443/TCP | 2d
laravel-project | NodePort | 10.105.178.73 | <none> | 80:32469/TCP | 10m
nginx-http | ClusterIP | 10.100.126.245 | <none> | 80/TCP | 20h
curl $(minikube service laravel-project — url)
http://192.168.99.100:32469/
kubectl get events

--

--

--

Hands-on data management professional. Working @Microsoft.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

The Language of Computers

Roadmap to become Front End web developer

How to Style any Input Field – Tips and Techniques

Storage Classes in C, simplified

5 Ways to Get Into Cloud Computing

Top 8 iOS Emulators for PC in 2022 (Windows & Mac) to Run iOS Apps

Biweekly Report 1)Make integration tests pass more reliably, some reducer refactoring; 2)Prepare…

File Transfer Application with Java and Grpc Spring services Part: 1

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Piethein Strengholt

Piethein Strengholt

Hands-on data management professional. Working @Microsoft.

More from Medium

Setup Container Redis, run commands, and publish/subscribe messages

Helm Chart: Release & Rollback

Helm Chart: Release & Rollback

Kong API Gateway — Docker Container

Keycloak Admin REST API