<p>I have existing applications built with Apache Camel and ActiveMQ. As part of migration to Kubernetes, what we are doing is moving the same services developed with Apache Camel to Kubernetes. I need to deploy ActiveMQ such that I do not lose the data in case one of the Pod dies. </p>

<p>What I am doing now is running a deployment with RelicaSet value to 2. This will start 2 pods and with a Service in front, I can serve any request while atleast 1 Pod is up. However, if one Pod dies, i do not want to lose the data. I want to implement something like a shared file system between the Pods. My environment is in AWS so I can use EBS. Can you suggest, how to achieve that.</p>

<p>Below is my deployment and service YAML.</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: smp-activemq
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: smp-activemq
    spec:
      containers:
        - name: smp-activemq
          image: dasdebde/activemq:5.15.9
          imagePullPolicy: IfNotPresent
          ports:
            - containerPort: 61616
          resources:
            limits:
              memory: 512Mi

---
apiVersion: v1
kind: Service
metadata:
  name: smp-activemq
spec:
  type: NodePort
  selector:
    app: smp-activemq
  ports:
    - nodePort: 32191
      port: 61616
      targetPort: 61616
</code></pre>

<p>In high-level terms, what you want is a <strong>StatefulSet</strong> instead of a Deployment for your ActiveMQ.  You are correct that you want "shared file system" -- in kubernetes this is expressed as a "<strong>Persistent Volume</strong>", which is made available to the pods in your StatefulSet using a "<strong>Volume Mount</strong>".</p>

<p>These are the things you need to look up.</p>
