K8s Storage Solutions
- Volumes: k8s Volume has a lifecycle equal to Pod. Once the Pod is deleted, the data will be lost
- Persistent Volumes: These volumes have lifecylce independent of Pod, So data will not be lost
- To create Persitent Volumes, We have two options
- Manual Provisioning: In this case we need to manually create the storage to be used by the k8s cluster
- Dynamic Provisioning: In this K8s will try to automatically create the storage based on the details provided. We prefer this approach on clouds
- K8s has the following types of persistent volumes Refer Here
- In K8s Storage Class provides a way for administrators to describe the classes of storage.
- If you are using managed k8s, it will already have some storage classes defined
- aks

- eks
- In K8s, we need to understand the relation between storage classes, Persistent Volumes and Persistent Volume Claims
- What is Persistent Volume Claim (PVC) => PVC is request for platform to create a persitent volume (PV) and attach it to your pods.
- Storage classes define the details (hardware details(ssd/hdd/block/file))
Pod -> PVC -> PV -> Target Machine (Type of this is defined by SC)
- When we are using the volume to mounted on multiple pods Refer Here
- Refer Here for the changeset containing changes to create a PVC which create a PV of size 1 GB of type managed-premium



-
Refer Here for the same in AWS

-
Stateful Sets: For storage solutions, where each instance of the application in Pod requires its own private volume then, we go for stateful sets. Stateful sets use PVC to claim PV.
-
Refer Here to view the journey of the application from code to k8s.
Helm
- Helm is a package-manager for k8s.
- When we want to create a package for our application, we create helm-chart. This package uses go-template syntax Refer Here
- Refer Here to install helm
- Refer Here for bitnami repo
- Lets install jenkins using help Refer Here
Note
- Creating Elastic Kubernetes Service Refer Here
- Install AWS CLI Refer Here
- Creating an IAM User: Refer Here
- Installing eksctl Refer Here
- Installing kubectl Refer Here
- To create cluster the command is
eksctl create cluster --name my-cluster --region region-code --version 1.22 --vpc-private-subnets subnet-ExampleID1,subnet-ExampleID2 --without-nodegroup
- Create a VPC using cloudformation template Refer Here. Make a note pf private subnet ids
- Create a node group
eksctl create nodegroup \
--cluster qt-cluster \
--region us-west-2 \
--name al-nodes \
--node-type t3.medium \
--nodes 2 \
--nodes-min 2 \
--nodes-max 4 \
--ssh-access \
--ssh-public-key monitoring \
--node-private-networking
Like this:
Like Loading...