dockerkubernetesrocketmq

Binary not found in Kubernetes deployment


I'm trying to deploy rocketmq on my testing cluster. I started from the scripts provided in the apache/rocketmq-docker repo on github, but they do not work. I created my own yaml deployment starting from the one in the repo I previously cited, and it works for mqnamsrv, but not for broker. In the following the 2 deployments:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: rocketmq-namesrv
spec:
  replicas: 1
  selector:
    matchLabels:
      app: rocketmq-namesrv
  template:
    metadata:
      labels:
        app: rocketmq-namesrv
    spec:
      containers:
      - name: namesrv
        image: myrepo/rocketmq:4.9.3-alpine
        command: ["sh", "mqnamesrv"]
        imagePullPolicy: IfNotPresent
        resources:
          limits:
            memory: "128Mi"
            cpu: "400m"
        ports:
        - containerPort: 9876
        volumeMounts:
        - name: namesrv-log
          mountPath: /var/log
      volumes:
      - name: namesrv-log
        persistentVolumeClaim:
          claimName: rocketmq-namesrv-pvc

---

apiVersion: apps/v1
kind: Deployment
metadata:
  name: rocketmq-broker
spec:
  replicas: 1
  selector:
    matchLabels:
      app: rocketmq-broker
  template:
    metadata:
      labels:
        app: rocketmq-broker
    spec:
      containers:
      - name: broker
        image: myrepo/rocketmq:4.9.3-alpine
        command: ["sh", "mqbroker", "-n", "localhost:9876"]
        imagePullPolicy: IfNotPresent
        resources:
          limits:
            memory: "128Mi"
            cpu: "400m"
        ports:
        - containerPort: 10909
        - containerPort: 10911
        volumeMounts:
        - name: broker-log
          mountPath: /var/log
        - name: broker-store
          mountPath: /home/rocketmq
      volumes:
      - name: broker-log
        persistentVolumeClaim:
          claimName: rocketmq-broker-log-pvc
      - name: broker-store
        persistentVolumeClaim:
          claimName: rocketmq-broker-store-pvc

The image rocketmq:4.9.3-alpine was created following the procedure on the apache/rocketmq-docker repo.

After the deployment the rocketmq-namesrv works, but the broker's pod logs: sh: can't open 'mqbroker': No such file or directory. ut if I try to run manually the container with kubectl run -ti rocketmq-broker --image=myrepo/rocketmq:4.9.3-alpine --restart=Never -- sh mqbroker -n localhost:9876 it works...

What could it be the problem in the yaml? Am I making something wrong?


Solution

  • I think the problem is with the mount path.

            - name: broker-store
              mountPath: /home/rocketmq
    

    So your binaries won't be there and so the error