Using AWS EBS Volumes in Kubernetes To Store Persistent Data for Kubernetes Versions < 1.23


In kubernetes it is possible to dynamically provision persistent volume claims in AWS which means we can directly create persistent volume claims for a certain application without having to worry about a persistent volume configuration using something storage classes. You can read more about storage classes here. Since this blog is more of a speedrun of setting up the dynamic provisioning , we shall directly dive into the yaml file configs.

Storage Class yaml config example is as below. Values can be changed according to needs:

Now we can create a persistent volume claim directly by using the storage class name which we configured above:

Applying this configuration would create a persistent volume claim as well as an EBS volume , and further the claim can be used to attach to a kubernetes application.

Please note that the above steps won’t work for kubernetes clusters above 1.23 . In order to use dynamic AWS provisioning for such clusters, you can refer this guide here.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Arnav Tripathy

Feline powered security engineer . Follow me for a wide variety of topics in the field of cyber security and dev(sec)ops. OSCP,CRTE,CRTP,CKA,CKAD holder.