Resize an AKS Deployment Persistent Volume Claim (PVC)

In this blog post, I will show to resize the size of a Persistent Volume Claim (PVC) in Azure Kubernetes Service (AKS) deployment.

In my case, I have a WordPress deployment on an Azure Kubernetes Service (AKS) cluster that by default, comes with 10GB of volume. My goal is to increase the volume to 14GB.

Resize Process

The process to resize an AKS PVC is as follow:

  • Scale the deployment to zero – This step will detach the pods in the deployment from the PVC.
  • Edit the PVC claim
  • Scale up the deployment

The first step in the process is one get the name of the deployment and note it down using the following Kubectl command:

kubectl get deployment

Now that we have the deployment, we need to find the Persistent Volume Claim (PVC) name using the following command:

kubectl get pvc

Now, I will scale down the deployment to zero using the following command.

kubectl scale deployment.apps/blogictweekly-wordpress --replicas=0

After the scale down, I will edit the PVC size using the edit command:

kubectl edit pvc blogictweekly-wordpress 

Press i to edit (vi editor) and change the values as shown below:

Press :wq to write the change and exit.

Now, I will scale up the deployment using the following command.

kubectl scale deployment.apps/blogictweekly-wordpress --replicas=1

To check the status, use the command one of the following commands:

kubectl get pvc blogictweekly-wordpress --namespace ingress-basic -o YAML
kubectl get pvc --namespace ingress-basic

At this stage, Kubernetes is waiting for the pod to start.

The end result is shown below:

For more AKS blog post, please visit the AKS page.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.