我目前正在尝试为我的项目部署简单的RabbitMQ集群。到目前为止,我找到了这两个适合我需要的示例。https://www.linkedin.com/pulse/deploying-rabbitmq-cluster-kubernetes-part-1-darshana-dinushal/
https://github.com/marcel-dempers/docker-development-youtube-series/blob/master/messaging/rabbitmq/kubernetes/rabbit-statefulset.yaml
由于Kubernetes上的官方网站、文章和教程视频都指向大规模生产部署,我只得到这2个例子。
当我尝试它的时候,RabbitMQ pod停留在挂起状态,而其他pod运行良好。
kubectl describe pod rabbitmq-0
Name: rabbitmq-0
Namespace: default
Priority: 0
Node: <none>
Labels: app=rabbitmq
controller-revision-hash=rabbitmq-84b847b5d5
statefulset.kubernetes.io/pod-name=rabbitmq-0
Annotations: <none>
Status: Pending
IP:
IPs: <none>
Controlled By: StatefulSet/rabbitmq
Init Containers:
config:
Image: busybox
Port: <none>
Host Port: <none>
Command:
/bin/sh
-c
cp /tmp/config/rabbitmq.conf /config/rabbitmq.conf && ls -l /config/ && cp /tmp/config/enabled_plugins /etc/rabbitmq/enabled_plugins
Environment: <none>
Mounts:
/config/ from config-file (rw)
/etc/rabbitmq/ from plugins-file (rw)
/tmp/config/ from config (rw)
/var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-ffj67 (ro)
Containers:
rabbitmq:
Image: rabbitmq:3.8-management
Ports: 4369/TCP, 5672/TCP
Host Ports: 0/TCP, 0/TCP
Environment:
RABBIT_POD_NAME: rabbitmq-0 (v1:metadata.name)
RABBIT_POD_NAMESPACE: default (v1:metadata.namespace)
RABBITMQ_NODENAME: rabbit@$(RABBIT_POD_NAME).rabbitmq.$(RABBIT_POD_NAMESPACE).svc.cluster.local
RABBITMQ_USE_LONGNAME: true
RABBITMQ_CONFIG_FILE: /config/rabbitmq
RABBITMQ_ERLANG_COOKIE: <set to the key 'RABBITMQ_ERLANG_COOKIE' in secret 'rabbit-secret'> Optional: false
K8S_HOSTNAME_SUFFIX: .rabbitmq.$(RABBIT_POD_NAMESPACE).svc.cluster.local
Mounts:
/config/ from config-file (rw)
/etc/rabbitmq/ from plugins-file (rw)
/var/lib/rabbitmq from data (rw)
/var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-ffj67 (ro)
Conditions:
Type Status
PodScheduled False
Volumes:
data:
Type: PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
ClaimName: data-rabbitmq-0
ReadOnly: false
config-file:
Type: EmptyDir (a temporary directory that shares a pod's lifetime)
Medium:
SizeLimit: <unset>
plugins-file:
Type: EmptyDir (a temporary directory that shares a pod's lifetime)
Medium:
SizeLimit: <unset>
config:
Type: ConfigMap (a volume populated by a ConfigMap)
Name: rabbitmq-config
Optional: false
kube-api-access-ffj67:
Type: Projected (a volume that contains injected data from multiple sources)
TokenExpirationSeconds: 3607
ConfigMapName: kube-root-ca.crt
ConfigMapOptional: <nil>
DownwardAPI: true
QoS Class: BestEffort
Node-Selectors: <none>
Tolerations: node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Warning FailedScheduling 2m25s (x39 over 89m) default-scheduler 0/1 nodes are available: 1 pod has unbound immediate PersistentVolumeClaims. preemption: 0/1 nodes are available: 1 Preemption is not helpful for scheduling.
1条答案
按热度按时间bnlyeluc1#
因为我已经测试过通过docker-compose部署RabbitMQ,它以前工作过。
我发现了一个叫做Kompose的工具,我用它把我的rabbitmq docker-compose文件转换成k8s yaml文件。
而且很管用!
从Kompose生成的Yaml文件。
服务档桉
部署文件