This tutorial is a walk-through of how to expand MySQL persistent volume with no downtime…
October 18, 2018
Kubernetes Tutorial: How to Expand MongoDB Persistent Volume With No Downtime on GKE
This tutorial is a walk-through of how to expand a MongoDB persistent volume with no downtime on Google Kubernetes Engine (GKE) by Certified Kubernetes Administrator (CKA) and Application Developer (CKAD) Janakiram MSV.
Janakiram MSV: Hi. In this demo, I’m going to walk you through the steps involved in dynamically expanding a volume that is backing MongoDB.
One of the challenges that DBS have is to ensure that there is enough space for the database workload to run. When the space is short, or when you run out of space, you got to expand it with minimal downtime and minimal disruption to the production workload. Thanks to Portworx, we can perform this operation without any downtime to the database workload. So let’s see how to do this.
So we have one pod that’s currently running MongoDB. We are going to now expand the volume size so that we have enough space for this pod or for this workload to grow. First, we are going to get access to the node on which the MongoDB pod is running, because we want to SSH into it to perform some storage operations. Then I’m going to use the gcloud command to SSH into the node on which our pod is running. You can essentially use any node, but it is just easy for us to get the name through the pod.
Now that we are inside the node, we can get the pod name associated with the PVC backing our MongoDB pod and then use it to inspect. Now, let’s run this command, which is pxctl volume inspect and the volume name that is backing the PVC. So here, we actually notice that the volume is of 1GB and it is replicated across three nodes, so a lot of insights from this output.
What we want to do now is to expand the size of this volume from 1GB to 2GB. So here, I invoke this command, pxctl with parameters volume update, volume name, and size is equal to 2, which will dynamically expand the volume size from 1GB to 2GB. So here, there is the output that says “volume update is successful”.
Now let’s go ahead and verify this. So now, when we actually run this command, we’ll see that it has been expanded from 1GB to 2GB. Ideally, this command should be run inside the node because it’s easy for you to get access to the pxctl binary, but if you are familiar, you can also access pxctl from one of the pods of the Portworx daemon set.
So that was how simple it is to expand the volume of a running storage cluster powered by Portworx. I hope you found this video useful. Thanks for watching.
Back to Blog