<p>I'm doing a migration of a Laravel Project from a docker-compose format to Kubernetes. I'm looking into a lot of approaches to run the project on Kubernetes, but I'm concerned about what should be the correct way to run the Laravel App and the Laravel Queue Workers on Kubernetes.</p>
<p>On my current format I have 3 containers on the docker-compose for the Laravel app (not counting with the Redis and Mysql container):</p>
<ul>
<li>PHP-FPM container</li>
<li>NGINX container</li>
<li>Supervisor container (configured to run the &quot;queue:work&quot; commands with the various queues I have)
All three share a volume with the project files.</li>
</ul>
<p>I've seen that for the NGINX and PHP-FPM containers, we can configure one pod with these 2 containers or 2 pods with 1 container each (I don't know which solution is best). We use a shared volume between the two, and when the php-fpm container is started, we copy the project files to the shared volume, because the volume only becomes available after the docker build phase (I do not think this is a good solution, but if it is necessary, ok). Example: <a href="https://matthewpalmer.net/kubernetes-app-developer/articles/php-fpm-nginx-kubernetes.html" rel="nofollow noreferrer">https://matthewpalmer.net/kubernetes-app-developer/articles/php-fpm-nginx-kubernetes.html</a></p>
<p>What should we do for the Laravel Queue Workers? Keep the supervisor container?</p>
<p>If you have any tips or links on what should be the correct way to run a Laravel App with Queue Workers, feel free to share.</p>
<p>Thanks, David</p>

David Pires
<p>You can try with <strong>Ingress</strong>, <strong>Service</strong> and <strong>Pod</strong> Architecture. I don't want to deep drive here. you can learn about more from google if you are not familiar with those.</p>
<p>Your <strong>Application</strong> pod and <strong>Supervisor</strong> pod should be different. That means 2 deployments needed with same image. So no need to shared volume here.</p>
<p>Application pod can be <strong>2</strong> or <strong>3</strong> replicas whatever you want.</p>
<p>Supervisor pod can be <strong>1</strong> idle case but if you want more worker then you can increase pod replicas or you can setup kubernetes <strong>hpa</strong>.</p>
<p>Here is some example of Supervisor pod deployment:</p>
<pre><code>    spec:
      containers:
      - args:
        - -n
        - -c
        - /etc/supervisor/supervisord.conf &lt;--- change your supervisord.conf path. remember you have to copy this from in your Dockerfile otherwise it will not work.
        command:
        - /usr/bin/supervisord 
</code></pre>
