Fixing storage mount issues
Earlier in this chapter, you noticed how the guestbook application lost data when the Redis master was moved to another node. This happened because that sample application didn't use any persistent storage. In this section, we'll cover an example of how PVCs can be used to prevent data loss when Kubernetes moves a Pod to another node. We will show you a common error that occurs when Kubernetes moves Pods with PVCs attached, and we will show you how to fix this.
For this, we will reuse the WordPress example from the previous chapter. Before we start, let's make sure that the cluster is in a clean state:
kubectl get all
This shows us just the one Kubernetes service, as shown in Figure 5.14:
Figure 5.14: You should only have the Kubernetes service running for now
Let's also ensure that both nodes are running and Ready
:
kubectl get nodes
This should show us both nodes in a Ready
state, as shown...