December 2017
Intermediate to advanced
404 pages
9h 28m
English
Next, let's create the MongoDB containers. Conceptually, they are not much different than the RabbitMQ container that you created in the preceding section. Just as before, we will use a StatefulSet with automatically provisioned volumes. Place the following contents in a new file called events-db-statefulset.yaml and then call kubectl apply on this file:
apiVersion: apps/v1beta1 kind: StatefulSet metadata: name: events-db spec: serviceName: events-db replicas: 1 template: metadata: labels: myevents/app: events myevents/tier: database spec: containers: - name: mongo image: mongo:3.4.3 ports: - containerPort: 27017 name: mongo volumeMounts: - name: database mountPath: /data/db volumeClaimTemplates: - metadata: ...
Read now
Unlock full access