我已经构建了一个rabbitmq docker容器映像,然后我想使用Kubernetes部署该容器。但是我有这个错误:
DIAGNOSTICS
===========
attempted to contact: ['rabbit@rabbitmq-deployment-b69fcfcf-fzvcw']
rabbit@rabbitmq-deployment-b69fcfcf-fzvcw:
* connected to epmd (port 4369) on rabbitmq-deployment-b69fcfcf-fzvcw
* epmd reports node 'rabbit' uses port 25672 for inter-node and CLI tool traffic
* TCP connection succeeded but Erlang distribution failed
* Authentication failed (rejected by the remote node), please check the Erlang cookie
Current node details:
* node name: 'rabbitmqcli61@rabbitmq-deployment-b69fcfcf-fzvcw'
* effective user's home directory: /home/rabbitmq
* Erlang cookie hash: LczRqz4DmQrqdzWYMchcog==
我正在使用erlang版本:21.0
RabbitMQ版本:3.7.7
kubectl version
命令显示:
Client Version: version.Info{Major:"1", Minor:"13", GitVersion:"v1.13.1", GitCommit:"eec55b9ba98609a46fee712359c7b5b365bdd920", GitTreeState:"clean", BuildDate:"2018-12-13T10:39:04Z", GoVersion:"go1.11.2", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"13", GitVersion:"v1.13.1", GitCommit:"eec55b9ba98609a46fee712359c7b5b365bdd920", GitTreeState:"clean", BuildDate:"2018-12-13T10:31:33Z", GoVersion:"go1.11.2", Compiler:"gc", Platform:"linux/amd64"}
Dockerfile:
FROM centos:7
ARG RABBIT_MQ_VERSION=3.7.7
ARG ERLANG_VERSION=21.0
RUN adduser -U rabbitmq &&\
yum install -y ca-certificates-2018.2.22 epel-release wget-1.14 &&\
DISTRO=$(sed -n 's/^distroverpkg=//p' /etc/yum.conf) &&\
RELEASE_SERVER=$(rpm -q --qf "%{version}" -f /etc/${DISTRO}) && \
RABBIT_MQ_REPO="http://dl.bintray.com/rabbitmq/rpm/rabbitmq-server/v${RABBIT_MQ_VERSION:0:3}.x/el/${RELEASE_SERVER}/" &&\
rpm --import https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc &&\
yum-config-manager --enable --add-repo ${RABBIT_MQ_REPO} &&\
wget http://packages.erlang-solutions.com/erlang-solutions-1.0-1.noarch.rpm &&\
rpm -Uvh erlang-solutions-1.0-1.noarch.rpm &&\
yum install -y erlang-${ERLANG_VERSION} &&\
rm -f erlang-solutions-1.0-1.noarch.rpm &&\
yum install -y rabbitmq-server-${RABBIT_MQ_VERSION} &&\
/usr/sbin/rabbitmq-plugins enable rabbitmq_management &&\
ln -sf /var/lib/rabbitmq/.erlang.cookie /home/rabbitmq/ &&\
chown -R rabbitmq:rabbitmq /var/lib/rabbitmq &&\
#echo -n 'cookie' > /root/.erlang.cookie &&\
#chmod 600 /root/.erlang.cookie &&\
yum clean all
COPY --chown=rabbitmq:rabbitmq files /
HEALTHCHECK --interval=5s --timeout=3s --retries=3 CMD /health.sh
USER rabbitmq:rabbitmq
EXPOSE 4369 5671 5672 25672 35672
ENTRYPOINT ["/entrypoint.sh"]
CMD ["rabbitmq-server"]
用于kubernetes部署的yaml文件:
apiVersion: v1
kind: Service
metadata:
name: tina-rabbitmq
namespace: 'default'
labels:
run: tina-rabbitmq
spec:
selector:
id: tina-rabbitmq
ports:
- port: 4369
targetPort: 4369
protocol: TCP
name: port1
- port: 5671
targetPort: 5671
protocol: TCP
name: port2
- port: 5672
targetPort: 5672
protocol: TCP
name: port3
- port: 25672
targetPort: 25672
protocol: TCP
name: port4
- port: 35672
targetPort: 35672
protocol: TCP
name: port5
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: rabbitmq-pv-claim
labels:
app: tina-rabbitmq
spec:
accessModes:
- ReadWriteMany
storageClassName: "par3-c1-ci1"
resources:
requests:
storage: 10Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: rabbitmq-deployment
labels:
app: tina-rabbitmq
spec:
replicas: 1
selector:
matchLabels:
app: tina-rabbitmq
template:
metadata:
labels:
app: tina-rabbitmq
spec:
containers:
- name: rabbitmq
image: 172.19.90.234:5001/rabbitmq_image:1.16
ports:
- containerPort: 5672
env:
- name: PASSWORD
valueFrom:
secretKeyRef:
name: rabbitmq-secret
key: password.txt
- name: RABBITMQ_ERLANG_COOKIE
valueFrom:
secretKeyRef:
name: rabbitmq-secret
key: cookie.txt
- name: USER
value: rabbitmq
volumeMounts:
- name: rabbitmq-persistent-storage
mountPath: /var/lib/rabbitmq
initContainers:
- name: change-volume-rights
image: centos:7
command: ['sh', '-c', 'chown -R 999:998 /var/lib/rabbitmq;']
volumeMounts:
- name: rabbitmq-persistent-storage
mountPath: /var/lib/rabbitmq
volumes:
- name: rabbitmq-persistent-storage
persistentVolumeClaim:
claimName: rabbitmq-pv-claim
imagePullSecrets:
- name: registry-dockerconfigjson
当我在RabbitMQ容器中运行命令rabbitmqctl status
时出现此错误:
warning: the VM is running with native name encoding of latin1 which may cause Elixir to malfunction as it expects utf8. Please ensure your locale is set to UTF-8 (which can be verified by running "locale" in your shell)
Status of node rabbit@rabbitmq-deployment-b69fcfcf-fzvcw ...
Error: unable to perform an operation on node 'rabbit@rabbitmq-deployment-b69fcfcf-fzvcw'. Please see diagnostics information and suggestions below.
Most common reasons for this are:
* Target node is unreachable (e.g. due to hostname resolution, TCP connection or firewall issues)
* CLI tool fails to authenticate with the server (e.g. due to CLI tool's Erlang cookie not matching that of the server)
* Target node is not running
In addition to the diagnostics info below:
* See the CLI, clustering and networking guides on http://rabbitmq.com/documentation.html to learn more
* Consult server logs on node rabbit@rabbitmq-deployment-b69fcfcf-fzvcw
DIAGNOSTICS
===========
attempted to contact: ['rabbit@rabbitmq-deployment-b69fcfcf-fzvcw']
rabbit@rabbitmq-deployment-b69fcfcf-fzvcw:
* connected to epmd (port 4369) on rabbitmq-deployment-b69fcfcf-fzvcw
* epmd reports node 'rabbit' uses port 25672 for inter-node and CLI tool traffic
* TCP connection succeeded but Erlang distribution failed
* Authentication failed (rejected by the remote node), please check the Erlang cookie
Current node details:
* node name: 'rabbitmqcli99@rabbitmq-deployment-b69fcfcf-fzvcw'
* effective user's home directory: /home/rabbitmq
* Erlang cookie hash: LczRqz4DmQrqdzWYMchcog==
[rabbitmq@rabbitmq-deployment-b69fcfcf-fzvcw /]$ rabbitmqctl status
warning: the VM is running with native name encoding of latin1 which may cause Elixir to malfunction as it expects utf8. Please ensure your locale is set to UTF-8 (which can be verified by running "locale" in your shell)
Status of node rabbit@rabbitmq-deployment-b69fcfcf-fzvcw ...
Error: unable to perform an operation on node 'rabbit@rabbitmq-deployment-b69fcfcf-fzvcw'. Please see diagnostics information and suggestions below.
Most common reasons for this are:
* Target node is unreachable (e.g. due to hostname resolution, TCP connection or firewall issues)
* CLI tool fails to authenticate with the server (e.g. due to CLI tool's Erlang cookie not matching that of the server)
* Target node is not running
In addition to the diagnostics info below:
* See the CLI, clustering and networking guides on http://rabbitmq.com/documentation.html to learn more
* Consult server logs on node rabbit@rabbitmq-deployment-b69fcfcf-fzvcw
DIAGNOSTICS
===========
attempted to contact: ['rabbit@rabbitmq-deployment-b69fcfcf-fzvcw']
rabbit@rabbitmq-deployment-b69fcfcf-fzvcw:
* connected to epmd (port 4369) on rabbitmq-deployment-b69fcfcf-fzvcw
* epmd reports node 'rabbit' uses port 25672 for inter-node and CLI tool traffic
* TCP connection succeeded but Erlang distribution failed
* Authentication failed (rejected by the remote node), please check the Erlang cookie
Current node details:
* node name: 'rabbitmqcli16@rabbitmq-deployment-b69fcfcf-fzvcw'
* effective user's home directory: /home/rabbitmq
* Erlang cookie hash: LczRqz4DmQrqdzWYMchcog==
我不知道该怎么办,请帮忙