- A+
所属分类:未分类
dockerfile
FROM rabbitmq:latest ENV RABBITMQ_USE_LONGNAME=true \ AUTOCLUSTER_LOG_LEVEL=debug \ AUTOCLUSTER_CLEANUP=true \ CLEANUP_INTERVAL=60 \ CLEANUP_WARN_ONLY=false \ AUTOCLUSTER_TYPE=k8s \ LANG=en_US.UTF-8 ADD plugins/*.ez /usr/lib/rabbitmq/lib/rabbitmq_server-3.6.8/plugins/ RUN rabbitmq-plugins enable --offline autocluster
deployment配置
apiVersion: extensions/v1beta1 kind: Deployment metadata: name: rabbitmq spec: replicas: 3 template: metadata: labels: app: rabbitmq spec: containers: - name: rabbitmq image: kuberstack/kubernetes-rabbitmq-autocluster ports: - containerPort: 5672 name: port-5672 - containerPort: 4369 name: port-4369 - containerPort: 5671 name: port-5671 - containerPort: 15672 name: port-15672 - containerPort: 25672 name: port-25672 env: - name: HOSTNAME valueFrom: fieldRef: fieldPath: status.podIP - name: MY_POD_IP valueFrom: fieldRef: fieldPath: status.podIP - name: AUTOCLUSTER_CLEANUP value: "true" - name: CLEANUP_INTERVAL value: "60" - name: CLEANUP_WARN_ONLY value: "false" # start.sh will store this value to a proper location in filesystem - name: RABBITMQ_ERLANG_COOKIE valueFrom: secretKeyRef: name: erlang.cookie key: erlang.cookie
srv配置
apiVersion: v1 kind: Service metadata: labels: app: rabbitmq name: rabbitmq spec: ports: - port: 5672 name: port-5672 - port: 4369 name: port-4369 - port: 5671 name: port-5671 - port: 15672 name: port-15672 - port: 25672 name: port-25672 selector: app: rabbitmq
erlang cookie创建
echo $(openssl rand -base64 32) > erlang.cookie kubectl -n $namespace create secret generic erlang.cookie --from-file=erlang.cookie kubectl -n $namespace create -f manifestos/rabbitmq-service.yaml
运行
kubectl -n $namespace create -f manifestos/rabbitmq-deploy.yaml
检查群集状态
FIRST_POD=$(kubectl get pods -n $namespace -l 'app=rabbitmq' -o jsonpath='{.items[0].metadata.name }') kubectl -n $namespace exec -ti $FIRST_POD rabbitmqctl cluster_status
访问测试
用户名guest密码guest
- 安卓客户端下载
- 微信扫一扫
- 微信公众号
- 微信公众号扫一扫