PHP script needs at least 3x the amount of ram on Kubernetes
I found the issues.
1 - The K8S deployment was setting the application to development mode. This is a Symfony application using Doctrine ORM. Doctrine ORM's profiling was active, this made it collect all the queries in memory, growing the amount of needed memory a lot. FOr long running processes with up to a million queries it was using around 500MB of RAM and after changing it to not profile it uses less than 30MB.
Lesson learned: Always check the production parameters.
2 - The second problem: For each time the cronjob runs K8S will run a new container with no Symfony cache. This will also impact memory usage. I solved this by warming up Symfony cache before pushing the image to the registry.