Deploying laravel application to Digital ocean kubernetes — Part 3

Deploying laravel application on Cloud Kubernetes.

We will be using digital ocean cloud managed kubernetes, so if you don’t have account on Digital ocean, you can use this link to create account in Digital Ocean get $100 credit.

We will be using all the configuration files which we have used in previous tutorial. So i would suggest you to look into once.

Now let’s create kubernetes cluster on Digital Ocean. Select Clusters from create menu.

Select Kubernetes version and Region

Select your cluster configuration, Number of nodes and it’s configurations.

Give a name to your cluster.

Digital ocean will start creating Kubernetes cluster and it will take few minutes.

Till then download kubernetes config file.

Once cluster gets ready, you can perform all command which you have been performing on local kubernetes.

Now let’s apply configuration file one by one. We are assuming you already have your application inside docker image with php inside.


Kubernetes configuration files uses yaml format. So we will have to define all our configuration files into .yaml format.






We will be exposing our service on 9000 Port.

Now with following command you can apply all this configurations to kubernetes cluster.

You will see pods and deployments will be started.

When you deploy nginx service of LoadBalancer type, it will create Load Balancer in Digital ocean by default.

Once load balancer is created you can go to LoadBalancer IP and access your application. But we need to do one more thing. As our nginx image doesn’t have application code, so we will need to copy code from php pod to shared volume, so our nginx server can access our application.

We will also need to change permissions of some directory, as some directory of laravel needs certain permissions, eg. storage and bootstrap.

And your application is live, on kubernetes cluster. You can scale up and down easily by changing number of replicas from config file or from kubernetes dashboard. You can also increase number of nodes very easily from digital ocean cluster configuration.

So this much it’s easy to deploy laravel application to kubernetes cluster. I hope you find it helpful.

If you want to follow along with video, here is youtube tutorial.

Thank you for reading. :)

We are here for quick tutorials, it may be server administration, server setup, dev ops, simple programming tips, simple hacks for server and many other things.