在 Kubernetes 部署中找不到二进制文件
Binary not found in Kubernetes deployment
我正在尝试在我的测试集群上部署 rocketmq。我从 apache/rocketmq-docker 存储库中提供的脚本开始 github,但它们不起作用。我从我之前引用的 repo 中的那个开始创建了我自己的 yaml 部署,它适用于 mqnamsrv,但不适用于代理。在以下 2 个部署中:
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
图像 rocketmq:4.9.3-alpine
是按照 apache/rocketmq-docker 存储库中的程序创建的。
部署后 rocketmq-namesrv 工作,但代理的 pod 日志:sh: can't open 'mqbroker': No such file or directory
。但是,如果我尝试 运行 手动 kubectl run -ti rocketmq-broker --image=myrepo/rocketmq:4.9.3-alpine --restart=Never -- sh mqbroker -n localhost:9876
容器,它会工作...
yaml 可能是什么问题?我是不是做错了什么?
我认为是挂载路径的问题。
- name: broker-store
mountPath: /home/rocketmq
所以你的二进制文件不会在那里,所以错误
我正在尝试在我的测试集群上部署 rocketmq。我从 apache/rocketmq-docker 存储库中提供的脚本开始 github,但它们不起作用。我从我之前引用的 repo 中的那个开始创建了我自己的 yaml 部署,它适用于 mqnamsrv,但不适用于代理。在以下 2 个部署中:
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
图像 rocketmq:4.9.3-alpine
是按照 apache/rocketmq-docker 存储库中的程序创建的。
部署后 rocketmq-namesrv 工作,但代理的 pod 日志:sh: can't open 'mqbroker': No such file or directory
。但是,如果我尝试 运行 手动 kubectl run -ti rocketmq-broker --image=myrepo/rocketmq:4.9.3-alpine --restart=Never -- sh mqbroker -n localhost:9876
容器,它会工作...
yaml 可能是什么问题?我是不是做错了什么?
我认为是挂载路径的问题。
- name: broker-store
mountPath: /home/rocketmq
所以你的二进制文件不会在那里,所以错误