Enable Dark Mode!
an-overview-of-kubernetes-storage.jpg
By: Anagha NK

An Overview Of Kubernetes Storage

Technical Odoo 16

Kubernetes is an open-source container-orchestration tool. It was designed by Google. In simple terms, it can be called K8s. The main features of Kubernetes are portable and extensible. It handles containerized workloads and services, facilitating automation and declarative configuration. Kubernetes services, support, and tools are widely available. The name Kubernetes is derived from the Greek word meaning helmsman or pilot. For managing environments like containerized systems, It was very useful in the cases of storage administrators. It is because it allows maintaining persistent and non-persistent data in the Kubernetes cluster in multiple forms. For dynamic storage resources, it makes it possible for different types of applications. The best way to use the Kubernetes Storage Framework is to automatically provision it with proper management.

Kubernetes Storage Concepts

An Overview Of Kubernetes Storage-cybrosys

Previous challenges were managing log data. Kubernetes addresses log data by sending it to an external system using solutions such as Elasticsearch LogStack and Kibana Stack.It’s features and capabilities address the challenge as they are rapidly growing and maturing. Kubernetes began with the storage features as part of pod Api and soon expanded these into standalone interfaces. Which includes volumes, persistent volume.storage classes, and container storage interface.

Pod: Smallest schedulable resource in Kubernetes. It is a logical collection of containers that ensures the encapsulated containers share resources and are hosted on the same node in your cluster

Containers use the principle of immutability. This means that they are destroyed. It includes all data that are created during the entire lifetime of containers. That is why Immutability was not always appropriate. Let’s take an example as ,if an application needs to share information or maintain its state but not lose the information. In this case, containers need a location to store this information permanently. Non-persistent type is the basic type of kubernetes storage. It's also known as ephemeral. Kubernetes also supports multiple types of persistent storage. It includes the files, blocks, or object storage services from cloud providers (eg: Amazon S3), storage devices in the local data center, or data services like databases.

In Kubernetes, and by extension OpenShift, this problem can be solved in several ways.

An Overview Of Kubernetes Storage-cybrosys

Configuring and Managing Storage (volumes) in Kubernetes

Difference between storage class and persistent volume 

Persistent Volume is a low-level representation of a storage volume. In Persistent Volume, Claim is used binding between a Pod and Persistent Volume. Storage Classes allow for the dynamic provisioning of Persistent Volumes.

Requirements steps

* Temporary: sorting and checkpoints

* Survivability: Survive container crashes

* Permanent: Containerized database

* Abstract the storage implementation details from containers.

Persistent volumes

An Overview Of Kubernetes Storage-cybrosysAn Overview Of Kubernetes Storage-cybrosys

Let’s check  the case of a Single node cluster and Take NFS as provident storage

An Overview Of Kubernetes Storage-cybrosys

First, we need to check the ephemeral directory or volume action. In yaml file,

apiVersion: v1
kind: Deployment
metadata:
name: task-pod-deployment
spec:
replicas:
  selector:
matchLabels:
app: test-pod
template:
metadata:
labels:
app: test-pod
spec:
volumes:
- name: cache-volumes
   emptyDir: { }
  containers:
- image: nginx
 name: test-pod-emptydir 
 volumeMounts:
mountPath: /cache
name: cache-volume

Kind: Deployment you can also use pods.

Under spec containers are described. Here describe the image that use (nginx), specify the name for it. UdervolumeMounts,mountPath describe the volume that will be loaded (cache under roots) and specify the name for volume mount.emptyDir is empty because here, the ephemeral volume will be loaded in this folder.

kubectl apply -f filename.yaml
kubectl get pods -o wide
kubectl exec -it $POD –sh
cd /cache
echo “Message to emptyDir storage” >test.txt
cat test.txt

Exit

Simulate a crash

Sudo reboot

Verify new pod created after crash

kubectl get pods -o wide

Saving new pod and ssh to file after crash

POD=$(kubectl get pods -no-headers -n default | awk ‘{print $1}’ | grep test-pod)
kubectl exec -it $POD - -sh
cd /cache
cat test.txt

exit

Clean up

kubectl delete -f test-pod-emptydir.yaml
The name of a StorageClass object is significant. It’s due to how users can request a particular class. Administrators can set the name. Also they can do other parameters of a class, if it creates StorageClass objects first time, and the objects are not updated once they are created.
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: standard
provisioner: kubernetes.io/aws-ebs
parameters:
type: gp2
reclaimPolicy: Retain
allowVolumeExpansion: true
mountOptions:
  - debug
volumeBindingMode: Immediate
reclaimPolicy: 
Field of the class. Either Delete or Retain.If no reclaimPolicy is specified when a StorageClass object is created, it will default to DeletePersistentVolumes and can be configured to be expandable. It will set to true, when it allows the users to resize the volume by editing the corresponding PVC object.

An Overview Of Kubernetes Storage-cybrosys

You can only use the volume expansion feature to grow a Volume, not to shrink it.

Persistent volumes are created by storage class dynamically. Mount options are specified here. volumeBindingMode controls dynamic provisioning occurring when volume binds. Unset, Immediate are default values. WaitForFirstConsumer is another mode. It delays the binding and provisioning of a PersistentVolume until a Pod using the PersistentVolumeClaim is created.

Kubernetes is an open-source container-orchestration tool. That is  stateless services such as microservices. The containers can be scheduled on any node without worrying about an affinity to a particular node or local storage provisioning. Kubernetes services, support, and tools are widely available. The best way is the Kubernetes storage framework can be used to automatically provision by properly managed.


If you need any assistance in odoo, we are online, please chat with us.



0
Comments



Leave a comment



whatsapp
location

Calicut

Cybrosys Technologies Pvt. Ltd.
Neospace, Kinfra Techno Park
Kakkancherry, Calicut
Kerala, India - 673635

location

Kochi

Cybrosys Technologies Pvt. Ltd.
1st Floor, Thapasya Building,
Infopark, Kakkanad,
Kochi, India - 682030.

location

Bangalore

Cybrosys Techno Solutions
The Estate, 8th Floor,
Dickenson Road,
Bangalore, India - 560042

Send Us A Message