In this article, I’m going to walk you through a “Devspace.sh” driven development workflow using Kubernetes, Minikube and Docker on macOS Monterey.
Devspace has some particular advantages being a wrapper around Kubernetes that makes development much more streamlined. As a Magento Developer, I want to be able to quickly edit Magento Module files and see a reflection of the updated code instantly. With Devspace’s syncing processes, one almost forgets he/she is developing an application inside a container and isn’t local on the machine itself.
To take it even further, Devspace.sh facilitates two more important functions that make development life more of a breeze. First, ports… Ports can get complicated when you’re dealing with multiple services and kubernetes. You want to be able to access your application locally and Devspace.sh honors that by forwarding all necessary ports each time you run its “dev” process.
Second, debugging. Running a debugger on your application in your favorite IDE becomes a piece of cake with devspace. You just turn it on and like magic, you have access to breakpoints and stepping procedures.
Elasticsearch (Opensearch), redis, mailhog, phpmyadmin, nginx and rabbitmq are all set up for your consumption by simply running a command or two.
I want to take a moment and thank Michael Karbowiak for being the initial creator of the devspace and docker configuration files that drive my process here. I, of course, also am grateful for all the contributors who made Magento what it is and all its underlying software too.
Michael’s config/github includes a bunch of modules in composer that extend Magento’s inherent setup. I highly recommend you check it out because there seem to be a lot of smart decisions made when crafting his selection that come from years of Magento2 experience. I personally must admit, I couldn’t get his composer.yaml working (even though now I recognize why and maybe you won’t have my problems), so opted for a clean composer.yaml that comes with Magento 2.4.3-p1 and no extra modules for this document/github selection. I will be revisiting his composer.yaml in the future and taking a closer look at each module he chose to add, because like I said, there is a lot of wisdom and experience in his choices.
I also made some decisions like using Docker Desktop with Minikube as the underlying container system instead of Parallels, Virtualbox, or VMWare Fusion. I found it to work a lot better than the other options (ran into a halting error), particularly an issue with diskspace using the other drivers. I had to configure Minikube and Docker to have 120GB of diskspace before things started working smoothly. I also noticed a performance increase in using Docker over the other options which were welcomed of course, given the amount of time to initially build containers and deploy them.
Minikube was also reverted to 1.24 instead of 1.25 due to a bug with RBAC configuration when you start minikube. I’ll include those instructions here as well.
Just as a prerequisite, you’re going to want to make sure ports 8080 and 3306 (and a few other less likely used ports) are free for this install, though you could easily configure the yaml’s to use different ports if you so choose.
Well, let’s get to it.
Prerequisite Software Setup
Install Docker Desktop by following these instructions:
https://docs.docker.com/desktop/mac/install/
Make sure you have Docker Desktop running before you proceed and make sure to configure it to have enough RAM, Swap, and CPUs in the configuration area. I’m going to suggest 10GB of RAM, 2GB Swap, and 3 CPUs which is what I’ll configure below, though it’s really going to depend on your system configuration and available resources. I also specified 120GB of hard disk space below, which is a bit overkill but I had it available.
Now, install Homebrew if you haven’t already. Homebrew is a macOS package manager that makes, at least, my life easier when it comes to managing packages and applications. Also as a prerequisite, if you have anything running on port 8443, well you’re going to either have to modify the instructions here or shut it off for now as well.
Homebrew Website (easy install on the homepage):
If you are using MacPorts, well, you can follow along and modify the instructions accordingly.
Next, we are going to install minikube and helm. Like I mentioned earlier, I’m going to recommend downgrading from 1.25.1 to 1.24.0 because of some issues that come up when starting minikube when configuring RBAC rules (according to some research I did, this issue is only present in 1.25 and has been raised to the minikube team):
So when using brew, to install an older version of minikube, you can try this in the terminal:
and if it isn’t found, then continue by installing a tap and extracting an older version (which is a repository of older versions I’d assume):
And then installing:
Also install helm:
Now let’s get things running
Now start minikube. I’m highly recommending giving the VM substantial resources, I leave you to figure out the best combo. Like I said earlier, make sure Docker Desktop is configured above or equal to these values below, otherwise, you’re going to see an error. Also, the amount of disk space was exaggerated by me because it seemed to resolve the disk space issues when dealing with the Docker driver:
Now let’s clone my Git repository. The scripts pull down a fresh version of Magento 2.4.3-p1 on initial setup and everytime it recreates the web container.
Now, enter that directory you just cloned and copy ./.container/auth.json to ./auth.json.
Goto https://devdocs.magento.com/guides/v2.4/install-gde/prereq/connect-auth.html
and follow the instructions for getting your public and private access keys for Magento 2. These will be your repo.magento.com user name and password.
Also, we are going to use Github to keep a private repository of your container packages using ghcr.io.
Follow these instructions here:
https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token
And make sure to select write:packages, read:packages, and delete:packages. I made my token never expire, but it’s probably better to make a new one every so often.
Once you get these credentials from Magento and Github, put them into your auth.json file. auth.json is ignored by git so it won’t be included in your repository if you commit any changes.
Now for the fun part. Let’s install devspace, switch the namespace and run it! If you do not have node installed, your going to want to install that using homebrew:
You’re going to be asked a series of questions. For the first question, change the default scarletbeast to your own GitHub username so it should look like this:
You can leave the default options for the second, third, and fourth questions by hitting <enter>.
And just like that, everything should build. Give it about 9 minutes or so depending on your computer speed and enjoy the magic:

Toward the end of the process, you will see a URL like:
Load it up and you will see your Pods status on the right. If everything goes well, they should all turn green eventually:

Once everything is green, let’s run a command to setup magento. Click the “Commands” button on the left-hand side. Run the following command, and let them run to completion:
-
setupeverything
Good. Now edit your /etc/hosts file and enter the following somewhere within it. Change the URL to match what you made the URL earlier when you were asked questions. In my case it is:
Now your URLs are as follows (if you went with defaults):
Dashboard: http://localhost:8090
Site: http://magento2.microk8s.local:8080/
Admin: http://magento2.microk8s.local:8080/admin
PHPMyAdmin: http://127.0.0.1:8070
RedisAdmin: http://127.0.0.1:8060
Mailhog: http://127.0.0.1:8025
Kibana: http://127.0.0.1:5601
RabbitMQ: http://127.0.0.1:15672
Log into the admin using user/pass admin/password123. It will ask you to change your password. Go ahead and change it.
Now Your all Set
XDebug is running on port 9003, so download the xdebug helper extension and configure your IDE and you should be set. You can also edit the Dockerfile.dev in .container to make XDebug call out to your IDE.
The PHPMyAdmin user and pass are root/rootpw.
Restarting your Container / Starting Fresh
You can shutdown minikube by running:
You can start minikube and devspace back up (make sure Docker Desktop is running):
You can delete everything and start fresh by running by running:
WARNING, this will delete database, containers, persistent volumes.. basically everything.

