@tressie.damore
To run Symfony Messenger worker on Kubernetes, you can follow these steps:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
apiVersion: apps/v1 kind: Deployment metadata: name: messenger-worker labels: app: messenger-worker spec: replicas: 1 selector: matchLabels: app: messenger-worker template: metadata: labels: app: messenger-worker spec: containers: - name: messenger-worker image: your-registry/messenger-worker-image:tag resources: limits: memory: "128Mi" cpu: "200m" # Add environment variables or config maps as needed env: - name: MESSENGER_TRANSPORT_DSN value: ... command: ["php", "bin/console", "messenger:consume"] |
Replace your-registry/messenger-worker-image:tag
with the actual URL of your Docker image.
1
|
kubectl apply -f messenger-worker-deployment.yaml |
This will create the Messenger worker pods as specified in the deployment configuration.
That's it! With this setup, Kubernetes will ensure the worker pods are running, restart them if they fail, and scale them up or down based on the defined replicas.