Tryin to run RabbitMQ on a local k8s cluster but it keeps restarting till will CrashLoopBackOff
with an error:
2021-12-28 18:11:50.098771+00:00 [erro] <0.846.0> Error on AMQP connection <0.846.0> (10.1.0.159:52048 -> 10.1.0.156:5672 - rabbitConnectionFactory#5dcbb60:0, vhost: '/', user: 'guest', state: running), channel 0:
2021-12-28 18:11:50.098771+00:00 [erro] <0.846.0> operation none caused a connection exception connection_forced: "broker forced connection closure with reason 'shutdown'"
2021-12-28 18:11:50.098771+00:00 [erro] <0.1089.0> Error on AMQP connection <0.1089.0> (10.1.0.158:54532 -> 10.1.0.156:5672 - rabbitConnectionFactory#102cec62:0, vhost: '/', user: 'guest', state: running), channel 0:
2021-12-28 18:11:50.098771+00:00 [erro] <0.1089.0> operation none caused a connection exception connection_forced: "broker forced connection closure with reason 'shutdown'"
2021-12-28 18:11:50.098888+00:00 [erro] <0.820.0> Error on AMQP connection <0.820.0> (10.1.0.155:51038 -> 10.1.0.156:5672 - rabbitConnectionFactory#67b7c170:10, vhost: '/', user: 'guest', state: running), channel 0:
2021-12-28 18:11:50.098888+00:00 [erro] <0.820.0> operation none caused a connection exception connection_forced: "broker forced connection closure with reason 'shutdown'"
service:
apiVersion: v1
kind: Service
metadata:
annotations:
appName: {{ include "common.fullname" . }}
componentName: rabbitmq
labels:
io.kompose.service: rabbitmq
name: rabbitmq
spec:
ports:
- name: "{{ .Values.service.ports.rabbitmq.port1 }}"
port: {{ .Values.service.ports.rabbitmq.port1 }}
targetPort: {{ .Values.service.ports.rabbitmq.port1 }}
- name: "{{ .Values.service.ports.rabbitmq.port2 }}"
port: {{ .Values.service.ports.rabbitmq.port2 }}
targetPort: {{ .Values.service.ports.rabbitmq.port2 }}
type: LoadBalancer
selector:
io.kompose.service: rabbitmq
status:
loadBalancer: {}
deployment:
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
appName: {{ include "common.fullname" . }}
componentName: rabbitmq
labels:
io.kompose.service: rabbitmq
{{- include "common.labels" . | nindent 4 }}
name: rabbitmq
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
io.kompose.service: rabbitmq
strategy: {}
template:
metadata:
annotations:
appName: {{ include "common.fullname" . }}
componentName: rabbitmq
labels:
io.kompose.service: rabbitmq
spec:
containers:
- env:
- name: DEFAULT_PASS
valueFrom:
secretKeyRef:
name: direct-secrets
key: rabbitmq-password
envFrom:
- configMapRef:
name: rabbitmq-configmap
image: rabbitmq:3-management
livenessProbe:
exec:
command:
- rabbitmq-diagnostics -q ping
failureThreshold: 3
periodSeconds: 30
timeoutSeconds: 30
name: rabbitmq
ports:
- containerPort: {{ .Values.app.rabbitmq.port1 }}
- containerPort: {{ .Values.app.rabbitmq.port2 }}
resources: {}
restartPolicy: Always
status: {}
configmap:
apiVersion: v1
kind: ConfigMap
metadata:
name: rabbitmq-configmap
data:
DEFAULT_USER: "{{ .Values.app.rabbitmq.user }}"
values:
app:
rabbitmq:
host: rabbitmq
port1: 5672
port2: 15672
password: guest
user: guest
service:
ports:
rabbitmq:
port1: 5672
targetPort1: 5672
port2: 15672
targetPort2: 15672
Any thoughts on that?
PS.
Output from the pod describe
:
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 17m default-scheduler Successfully assigned default/rabbitmq-df54875b8-6m4dq to docker-desktop
Normal Killing 12m (x3 over 15m) kubelet Container rabbitmq failed liveness probe, will be restarted
Normal Pulled 11m (x4 over 16m) kubelet Container image "rabbitmq:3-management" already present on machine
Normal Created 11m (x4 over 16m) kubelet Created container rabbitmq
Normal Started 11m (x4 over 16m) kubelet Started container rabbitmq
Warning Unhealthy 95s (x24 over 16m) kubelet Liveness probe failed: OCI runtime exec failed: exec failed: container_linux.go:380: starting container process caused: exec: "rabbitmq-diagnostics -q ping": executable file not found in $PATH: unknown
For some reason is not able to find rabbitmq-diagnostics
which was present in previous images.
It came up that image contains rabbitmq-diagnostics
but when you will specify command as a single string like that, it's looking for a binary in the path that's literally the full string, including spaces, rabbitmq-diagnostics -q ping
, so it should be something like this instead:
command:
- rabbitmq-diagnostics
- -q
- ping
or:
command: ['rabbitmq-diagnostics', '-q', 'ping']