"bench --site $(SITE_NAME) migrate" fails in Kubernetes (helm)

Hello Team,

Request your help in understanding the issue and any documentation on the same helps.
I customised helm to create a site and migrate. The site is being created but when it comes to migrate, it is failing at Retrieving Routes after building Search Index.
I referred [erpnext 7.0.175 · frappe/erpnext](https://Frappe Artifact Hub) and tried migration separately but it is failing (below are the details).
ERPNext Version: 14.*

Updating Account list_view...
Updating Cost Center list_view...
Updating Bank Account list_view...
Updating Standard Supplier...
Updating Custom Naming Format...
Salary Slip
Purchase Order
Delivery Note
Sales Order
Customer
Item
Job Requisition
Staffing Plan
File
Purchase Invoice
Bank Account
Employee Tax Exemption Declaration
Attendance Request
Lead
Employee Performance Feedback
Purchase Receipt
Employee
Issue
Appraisal
Building search index for mysite.staging.site.ai : [-------------------------] 100%

Retrieving Routes                   : [                                        ] 1%

If the migration process gets stuck you’ll need to find out why it gets stuck.

Exec into gunicorn pod, try migrate there if it shows better errors. Use bench console to migrate using python, if that shows detailed errors.

You need to find out what causes the issue.

When using bench migrate from the gunicorn pod manually, there isn’t any failure.

But when using the helm template, it is failing. Checked in the mountPath: /home/frappe/frappe-bench/logs and there isn’t any error information to understand why it failed/Retrieving Route is not complete.

I am trying to understand when migrate from gunicorn pod is possible why is it not possible using the kubectl job using helm template. All other site related (create a site, drop a site. etc) are working. I am trying to understand does it have something to do with version compatibility?

bench --site site.name migrate has no changes in v14 and v15

Compare the yaml spec of gunicorn deployment and migrate job for anything different.