We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Attach Persistence

So far all we've done is create an empty persistent volume. Let's get the api application to use it.

Assignment

Use your crawler deployment and the docs as a reference. Create a new volume in the api-deployment referencing your pvc:

volumes:
  - name: synergychat-api-volume
    persistentVolumeClaim:
      claimName: synergychat-api-pvc

Then mount it in the container under the /persist directory:

volumeMounts:
  - name: synergychat-api-volume
    mountPath: /persist

Update the API_DB_FILEPATH environment variable you added earlier to instead use the new mount path: /persist/db.json

Apply the changes, then check to make sure all your pods are healthy:

kubectl get pods

With your tunnel running (minikube tunnel -c), open http://synchat.internal/ in your browser.

  1. Send some messages.
  2. Delete the api pod.
  3. Once the new pod is running, refresh the page and make sure your messages are still there. If they are, your persistent volume is working!