mirror of
https://github.com/clearlinux/dockerfiles.git
synced 2026-09-06 05:32:03 +00:00
154 lines
3.7 KiB
YAML
154 lines
3.7 KiB
YAML
apiVersion: v1
|
|
kind: ServiceAccount
|
|
metadata:
|
|
name: rabbitmq
|
|
namespace: test-rabbitmq
|
|
|
|
---
|
|
kind: Role
|
|
apiVersion: rbac.authorization.k8s.io/v1beta1
|
|
metadata:
|
|
name: endpoint-reader
|
|
namespace: test-rabbitmq
|
|
rules:
|
|
- apiGroups: [""]
|
|
resources: ["endpoints"]
|
|
verbs: ["get"]
|
|
|
|
---
|
|
kind: RoleBinding
|
|
apiVersion: rbac.authorization.k8s.io/v1beta1
|
|
metadata:
|
|
name: endpoint-reader
|
|
namespace: test-rabbitmq
|
|
subjects:
|
|
- kind: ServiceAccount
|
|
name: rabbitmq
|
|
roleRef:
|
|
apiGroup: rbac.authorization.k8s.io
|
|
kind: Role
|
|
name: endpoint-reader
|
|
|
|
---
|
|
kind: Service
|
|
apiVersion: v1
|
|
metadata:
|
|
namespace: test-rabbitmq
|
|
name: rabbitmq
|
|
labels:
|
|
app: rabbitmq
|
|
type: LoadBalancer
|
|
spec:
|
|
type: NodePort
|
|
ports:
|
|
- name: http
|
|
protocol: TCP
|
|
port: 15672
|
|
targetPort: 15672
|
|
nodePort: 31672
|
|
- name: amqp
|
|
protocol: TCP
|
|
port: 5672
|
|
targetPort: 5672
|
|
nodePort: 30672
|
|
selector:
|
|
app: rabbitmq
|
|
---
|
|
apiVersion: v1
|
|
kind: ConfigMap
|
|
metadata:
|
|
name: rabbitmq-config
|
|
namespace: test-rabbitmq
|
|
data:
|
|
enabled_plugins: |
|
|
[rabbitmq_peer_discovery_k8s].
|
|
|
|
rabbitmq.conf: |
|
|
cluster_formation.peer_discovery_backend = rabbit_peer_discovery_k8s
|
|
cluster_formation.k8s.host = kubernetes.default.svc.cluster.local
|
|
cluster_formation.k8s.address_type = hostname
|
|
cluster_formation.node_cleanup.interval = 30
|
|
cluster_formation.node_cleanup.only_log_warning = true
|
|
cluster_partition_handling = autoheal
|
|
queue_master_locator=min-masters
|
|
loopback_users.guest = false
|
|
listeners.tcp.default = 5672
|
|
hipe_compile = false
|
|
|
|
---
|
|
apiVersion: apps/v1beta1
|
|
kind: StatefulSet
|
|
metadata:
|
|
name: rabbitmq
|
|
namespace: test-rabbitmq
|
|
spec:
|
|
serviceName: rabbitmq
|
|
replicas: 3
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: rabbitmq
|
|
spec:
|
|
serviceAccountName: rabbitmq
|
|
terminationGracePeriodSeconds: 10
|
|
containers:
|
|
- name: rabbitmq-k8s
|
|
image: docker.io/clearlinux/rabbitmq
|
|
volumeMounts:
|
|
- name: config-volume
|
|
mountPath: /etc/rabbitmq
|
|
ports:
|
|
- name: http
|
|
protocol: TCP
|
|
containerPort: 15672
|
|
- name: amqp
|
|
protocol: TCP
|
|
containerPort: 5672
|
|
livenessProbe:
|
|
exec:
|
|
command: ["rabbitmqctl", "status"]
|
|
initialDelaySeconds: 60
|
|
periodSeconds: 60
|
|
timeoutSeconds: 15
|
|
readinessProbe:
|
|
exec:
|
|
command: ["rabbitmqctl", "status"]
|
|
initialDelaySeconds: 20
|
|
periodSeconds: 60
|
|
timeoutSeconds: 10
|
|
imagePullPolicy: Always
|
|
env:
|
|
- name: MY_POD_NAME
|
|
valueFrom:
|
|
fieldRef:
|
|
apiVersion: v1
|
|
fieldPath: metadata.name
|
|
- name: MY_POD_NAMESPACE
|
|
valueFrom:
|
|
fieldRef:
|
|
fieldPath: metadata.namespace
|
|
- name: MY_POD_SERVICE_ACCOUNT
|
|
valueFrom:
|
|
fieldRef:
|
|
fieldPath: spec.serviceAccountName
|
|
- name: RABBITMQ_USE_LONGNAME
|
|
value: "true"
|
|
- name: RABBITMQ_NODENAME
|
|
value: rabbit@$(MY_POD_NAME).$(MY_POD_SERVICE_ACCOUNT).$(MY_POD_NAMESPACE).svc.cluster.local
|
|
- name: K8S_HOSTNAME_SUFFIX
|
|
value: .$(MY_POD_SERVICE_ACCOUNT).$(MY_POD_NAMESPACE).svc.cluster.local
|
|
- name: K8S_SERVICE_NAME
|
|
value: $(MY_POD_SERVICE_ACCOUNT)
|
|
- name: RABBITMQ_ERLANG_COOKIE
|
|
value: "mycookie"
|
|
volumes:
|
|
- name: config-volume
|
|
configMap:
|
|
name: rabbitmq-config
|
|
items:
|
|
- key: rabbitmq.conf
|
|
path: rabbitmq.conf
|
|
- key: enabled_plugins
|
|
path: enabled_plugins
|
|
|