Last week I created the below with a dummy database and is something that I will do against SQL server but this time that has a persistent volume claim.
CREATE TABLE Employee (EmpID INT NOT NULL , EmpName VARCHAR(50) NOT NULL, Designation VARCHAR(50) NULL, Department VARCHAR(50) NULL, JoiningDate DATETIME NULL, ) INSERT INTO Employee (EmpID, EmpName, Designation, Department, JoiningDate) VALUES (1, 'ArunS', 'LAB GEEK', 'LAB', GETDATE()), (2, 'BillG', 'SENIOR TECH', 'CIO', GETDATE()) SELECT * FROM sys.sysfiles
This YAML file that I used for this blog post is different to the last one, the difference is shown below via the persistent volume claim.
The key bit being:
volumeMounts: - name: mssqldb mountPath: /var/opt/mssql volumes: - name: mssqldb persistentVolumeClaim: claimName: mssql-data
Let’s take a step back and look at my nodes.
Is it number 000007 that owns the PVC data disk, you can see this if you go to the virtual machine scale set and find the relevant VM.
I click on vmss_7.
So what happens if I shut this down?
kubectl get events | grep -i volume
Issues will occur.
So, I start it back up.
We can connect back to SQL server and the great thing here – data remains as it was before my VM shut down. That’s the key bit really. My data is still there unlike part 1 and if you are using SQL server then you will probably want it persisted right?