12 Temmuz 2022 Salı

nfs Volume

Giriş
Network-Attached Storage(NAS) kavramına bakmak lazım. Açıklaması şöyle. Yani NAS kendi işlemcisi, işletim sistemi olan müstakil bir bilgisayar gibi.
Have you ever wondered how businesses shared files and data across computers within a network in the 1980s? They relied on network-attached storage(NAS) - a reliable and efficient way to deliver unstructured data to the network-connected devices using an ethernet connection.

With time, different technologies have become prominent, including cloud storage offering cheap online storage. However, NAS still solves the critical business pain point of intuitively sharing files within an organization.
Kullanılan protokoller şöyle
NAS box supports various protocols for file formatting transferred across the network. These include:
Network File System(NFS)
- Server Message Blocks(SMB)
- Apple Filing Protocol(AFP)
- Internetwork Packet Exchange
- Common Internet File System(CIFS)
- NetBIOS Extended User Interface
Kullanım
1. Podda kullanmak için volumes ile direkt yüklenebilir. Bu durumda nfs sunucusunun IP adresini belirtmek gerekir.
2. Podda kullanmak için PersistentVolumeClaim ile isim belirtilir

1. Volume Olarak Direkt Kullanma
Örnek
Şöyle yaparız
#Pod definiton with nfs share directory
apiVersion: v1
kind: Pod
metadata:
  name: webserver
spec:
  containers:
  - image: nginx:latest
    name: nginx-container
    volumeMounts:
    - mountPath: /usr/share/nginx/html
      name: test-vol
  volumes:
  - name: test-vol
    nfs:
      server: 10.3.97.250           # nfs server ip or dns
      path: /var/local/nfs-share    # nfs share directory
2. NFS'i PersistentVolume Olarak Yaratma
Örnek
Şöyle yaparız
#PV using NFS-Share directory
apiVersion: v1
kind: PersistentVolume
metadata:
  name: pv-nfs
spec:
  capacity:
    storage: 20Gi
  accessModes:
    - ReadWriteOnce
  nfs:
    path: /var/nfs_server/kubernetes_data
    server: 10.25.96.6     #IP or DNS of nfs server
Örnek
PersistentVolume yaratılır. Şöyle yaparız
apiVersion: v1
kind: PersistentVolume
metadata:
  name: my-pv
spec:
  capacity:
    storage: 10Gi
  volumeMode: Filesystem
  accessModes:
    - ReadWriteOnce
  persistentVolumeReclaimPolicy: Recycle
  storageClassName: any-name
  nfs:
    path: /test
    server: 10.0.0.0
PersistentVolumeClaim yaratılır. Şöyle yaparız
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: my-pvc
spec:
  accessModes:
    - ReadWriteOnce
  volumeMode: Filesystem
  resources:
    requests:
      storage: 10Gi
  storageClassName: any-name
Pod'da kullanmak için şöyle yaparız
apiVersion: v1
kind: Pod
metadata:
 name: pod-with-volume
spec:
 containers:
 - image: nginx
   name: pod-with-volume
   volumeMounts:
   - mountPath: /data
     name: my-volume
 volumes:
 - name: my-volume
   persistentVolumeClaim:
     claimName: my-pvc



Hiç yorum yok:

Yorum Gönder

Cluster Propotional Autoscaler - ReplicaSet Ekler/Siler

Giriş Açıklaması şöyle CPA aims to horizontally scale the number of Pod replicas based on the cluster’s scale. A common example is DNS ser...