{"id":94739,"date":"2020-09-20T19:42:27","date_gmt":"2020-09-20T17:42:27","guid":{"rendered":"https:\/\/prohoster.info\/blog\/administrirovanie\/prakticheskij-primer-podklyucheniya-hranilishha-na-baze-ceph-v-klaster-kubernetes"},"modified":"2021-01-02T13:05:08","modified_gmt":"2021-01-02T11:05:08","slug":"prakticheskij-primer-podklyucheniya-hranilishha-na-baze-ceph-v-klaster-kubernetes","status":"publish","type":"post","link":"https:\/\/prohoster.info\/sq\/blog\/administrirovanie\/prakticheskij-primer-podklyucheniya-hranilishha-na-baze-ceph-v-klaster-kubernetes","title":{"rendered":"Shembulli praktik i lidhjes s\u00eb ruajtjes s\u00eb bazuar n\u00eb Ceph n\u00eb klasterin Kubernetes.","gt_translate_keys":[{"key":"rendered","format":"text"}]},"content":{"rendered":"<p>Container Storage Interface (CSI) \u00ebsht\u00eb nj\u00eb nd\u00ebrfaqe e unifikuar e bashk\u00ebveprimit midis Kubernetes dhe sistemeve t\u00eb ruajtjes s\u00eb t\u00eb dh\u00ebnave. N\u00eb shkurt, p\u00ebr t\u00eb njohur at\u00eb, ne tashm\u00eb <noindex><a rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/company\/southbridge\/blog\/519130\/\">treguam<\/a><\/noindex>, dhe sot do t\u00eb shqyrtojm\u00eb m\u00eb n\u00eb detaje lidhjen CSI dhe Ceph: do t\u00eb tregojm\u00eb se si <noindex><a rel=\"nofollow\" href=\"http:\/\/to.slurm.io\/WkM2Eg\">t\u00eb lidhim ruajtjen Ceph<\/a><\/noindex> me klasterin Kubernetes.<br \/>\nN\u00eb k\u00ebt\u00eb artikull do t\u00eb sjellim shembuj real\u00eb, ndon\u00ebse pak t\u00eb thjeshtuar p\u00ebr t\u00eb leht\u00ebsuar kuptimin. Instalimi dhe konfigurimi i klaster\u00ebve Ceph dhe Kubernetes nuk do t\u00eb shqyrtohen.<\/p>\n<p>A jeni t\u00eb interesuar p\u00ebr m\u00ebnyr\u00ebn se si funksionon kjo?<\/p>\n<p><img decoding=\"async\" alt=\"Shembulli praktik i lidhjes s\u00eb ruajtjes s\u00eb bazuar n\u00eb Ceph n\u00eb klasterin Kubernetes.\" src=\"\/wp-content\/uploads\/2020\/09\/db0a1d1e4c38c693f591057a219c141c.jpg\" style=\"display:block;margin: 0 auto;\"><\/p>\n<p><noindex><a rel=\"nofollow\" name=\"habracut\"><\/a><\/noindex><\/p>\n<p>K\u00ebshtu, keni n\u00eb duar nj\u00eb klaster Kubernetes, i shp\u00ebrndar\u00eb, p\u00ebr shembull, <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/kubernetes-sigs\/kubespray\">kubespray<\/a><\/noindex>. Pran\u00eb tij funksionon nj\u00eb klaster Ceph \u2014 gjithashtu mund ta instaloni, p\u00ebr shembull, me k\u00ebt\u00eb <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/ceph\/ceph-ansible\">grup playbook-\u00ebsh<\/a><\/noindex>. Shpresoj se nuk \u00ebsht\u00eb e nevojshme t\u00eb p\u00ebrmend se p\u00ebr prodhim, mes tyre duhet t\u00eb ket\u00eb nj\u00eb rrjet me kapacitet minimal prej 10 Gbit\/s.<\/p>\n<p>N\u00ebse gjith\u00e7ka kjo e keni, le t\u00eb fillojm\u00eb!<\/p>\n<p>S\u00eb pari, hyjm\u00eb n\u00eb nj\u00eb nga nodet e klasterit Ceph dhe kontrollojm\u00eb q\u00eb gjith\u00e7ka \u00ebsht\u00eb n\u00eb rregull:<\/p>\n<pre><code class=\"plaintext\">ceph health\nceph -s<\/code><\/pre>\n<p>M\u00eb tej, menj\u00ebher\u00eb krijojm\u00eb nj\u00eb pool p\u00ebr disqet RBD:<\/p>\n<pre><code class=\"plaintext\">ceph osd pool create kube 32\nceph osd pool application enable kube rbd<\/code><\/pre>\n<p>Tani kalojm\u00eb n\u00eb klasterin Kubernetes. Atje s\u00eb pari do t\u00eb instalojm\u00eb Ceph CSI driver p\u00ebr RBD. Do ta instalojm\u00eb, si\u00e7 duhet, p\u00ebrmes Helm.<br \/>\nShtojm\u00eb repository-n me chartin, dhe marrim setin e variablave t\u00eb chartit ceph-csi-rbd:<\/p>\n<pre><code class=\"plaintext\">helm repo add ceph-csi https:\/\/ceph.github.io\/csi-charts\nhelm inspect values ceph-csi\/ceph-csi-rbd &gt; cephrbd.yml<\/code><\/pre>\n<p>Tani duhet t\u00eb plot\u00ebsojm\u00eb skedarin cephrbd.yml. P\u00ebr k\u00ebt\u00eb, m\u00ebsojm\u00eb ID-n\u00eb e klasterit dhe adresat IP t\u00eb monitor\u00ebve n\u00eb Ceph:<\/p>\n<pre><code class=\"plaintext\">ceph fsid  # k\u00ebshtu do t\u00eb m\u00ebsojm\u00eb clusterID\nceph mon dump  # dhe k\u00ebshtu do t\u00eb shohim adresat IP t\u00eb monitor\u00ebve<\/code><\/pre>\n<p>Vlerat e marra i vendosim n\u00eb skedarin cephrbd.yml. Nd\u00ebrkoh\u00eb, aktivizojm\u00eb krijimin e politikave PSP (Pod Security Policies). Opsionet n\u00eb seksionet <strong>nodeplugin<\/strong> \u0438 <strong>provisioner<\/strong> s jan\u00eb gjithashtu n\u00eb skedar, mund t'i rregullojm\u00eb si\u00e7 \u00ebsht\u00eb treguar m\u00eb posht\u00eb:<\/p>\n<pre><code class=\"plaintext\">csiConfig:\n  - clusterID: \"bcd0d202-fba8-4352-b25d-75c89258d5ab\"\n    monitors:\n      - \"v2:172.18.8.5:3300\/0,v1:172.18.8.5:6789\/0\"\n      - \"v2:172.18.8.6:3300\/0,v1:172.18.8.6:6789\/0\"\n      - \"v2:172.18.8.7:3300\/0,v1:172.18.8.7:6789\/0\"\n\nnodeplugin:\n  podSecurityPolicy:\n    enabled: true\n\nprovisioner:\n  podSecurityPolicy:\n    enabled: true<\/code><\/pre>\n<p>M\u00eb pas, gjith\u00e7ka q\u00eb na mbetet \u00ebsht\u00eb t\u00eb instalojm\u00eb chartin n\u00eb klasterin Kubernetes.<\/p>\n<pre><code class=\"plaintext\">helm upgrade -i ceph-csi-rbd ceph-csi\/ceph-csi-rbd -f cephrbd.yml -n ceph-csi-rbd --create-namespace<\/code><\/pre>\n<p>Shk\u00eblqyer, RBD driver funksionon!<br \/>\nT\u00eb krijojm\u00eb nj\u00eb StorageClass t\u00eb re n\u00eb Kubernetes. P\u00ebr k\u00ebt\u00eb, do t\u00eb k\u00ebrkohet pak pun\u00eb s\u00ebrish me Ceph.<\/p>\n<p>Krijojm\u00eb nj\u00eb p\u00ebrdorues t\u00eb ri n\u00eb Ceph dhe i japim t\u00eb drejtat p\u00ebr t\u00eb shkruar n\u00eb pool-in <strong>kube<\/strong>:<\/p>\n<pre><code class=\"plaintext\">ceph auth get-or-create client.rbdkube mon 'profile rbd' osd 'profile rbd pool=kube'<\/code><\/pre>\n<p>Tani le t\u00eb shohim \u00e7el\u00ebsin e qasjes gjith\u00eb atje:<\/p>\n<pre><code class=\"plaintext\">ceph auth get-key client.rbdkube<\/code><\/pre>\n<p>Komanda do t\u00eb jap\u00eb di\u00e7ka t\u00eb till\u00eb:<\/p>\n<pre><code class=\"plaintext\">AQCO9NJbhYipKRAAMqZsnqqS\/T8OYQX20xIa9A==<\/code><\/pre>\n<p>Ta vendosim k\u00ebt\u00eb vler\u00eb n\u00eb Secret n\u00eb klasterin Kubernetes \u2014 aty ku \u00ebsht\u00eb e nevojshme <strong>userKey<\/strong>:<\/p>\n<pre><code class=\"plaintext\">---\napiVersion: v1\nkind: Secret\nmetadata:\n  name: csi-rbd-secret\n  namespace: ceph-csi-rbd\nstringData:\n  # Vlerat e \u00e7el\u00ebsve i p\u00ebrgjigjen emrit t\u00eb p\u00ebrdoruesit dhe \u00e7el\u00ebsit t\u00eb tij, si\u00e7 \u00ebsht\u00eb e specifikuar n\u00eb\n  # clusterin Ceph. ID e p\u00ebrdoruesit duhet t\u00eb ket\u00eb qasje n\u00eb pool-in,\n  # t\u00eb caktuar n\u00eb storage class\n  userID: rbdkube\n  userKey:<\/code><\/pre>\n<p>Dhe krijojm\u00eb sekretin ton\u00eb:<\/p>\n<pre><code class=\"plaintext\">kubectl apply -f secret.yaml<\/code><\/pre>\n<p>M\u00eb pas na nevojitet nj\u00eb manifest StorageClass si ky:<\/p>\n<pre><code class=\"plaintext\">---\napiVersion: storage.k8s.io\/v1\nkind: StorageClass\nmetadata:\n   name: csi-rbd-sc\nprovisioner: rbd.csi.ceph.com\nparameters:\n   clusterID: \n   pool: kube\n\n   imageFeatures: layering\n\n   # K\u00ebto sekrete duhet t\u00eb p\u00ebrmbajn\u00eb t\u00eb dh\u00ebna p\u00ebr autorizim\n   # n\u00eb pool-in tuaj.\n   csi.storage.k8s.io\/provisioner-secret-name: csi-rbd-secret\n   csi.storage.k8s.io\/provisioner-secret-namespace: ceph-csi-rbd\n   csi.storage.k8s.io\/controller-expand-secret-name: csi-rbd-secret\n   csi.storage.k8s.io\/controller-expand-secret-namespace: ceph-csi-rbd\n   csi.storage.k8s.io\/node-stage-secret-name: csi-rbd-secret\n   csi.storage.k8s.io\/node-stage-secret-namespace: ceph-csi-rbd\n\n   csi.storage.k8s.io\/fstype: ext4\n\nreclaimPolicy: Delete\nallowVolumeExpansion: true\nmountOptions:\n  - discard<\/code><\/pre>\n<p>Duhet t\u00eb plot\u00ebsohet <strong>clusterID<\/strong>, t\u00eb cilin ne tashm\u00eb e kemi m\u00ebsuar me komand\u00ebn <em>ceph fsid<\/em>, dhe t\u00eb aplikojm\u00eb k\u00ebt\u00eb manifest n\u00eb klasterin Kubernetes:<\/p>\n<pre><code class=\"plaintext\">kubectl apply -f storageclass.yaml<\/code><\/pre>\n<p>P\u00ebr t\u00eb kontrolluar funksionimin e klastereve n\u00eb lidhje, le t\u00eb krijojm\u00eb nj\u00eb PVC t\u00eb till\u00eb (P\u00ebrdorimi i Volume t\u00eb P\u00ebrs\u00ebritsh\u00ebm):<\/p>\n<pre><code class=\"plaintext\">apiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: rbd-pvc\nspec:\n  accessModes:\n  - ReadWriteOnce\n  resources:\n    requests:\n      storage: 1Gi\n  storageClassName: csi-rbd-sc<\/code><\/pre>\n<p>T\u00eb shohim se si Kubernetes ka krijuar volumet e k\u00ebrkuara n\u00eb Ceph:<\/p>\n<pre><code class=\"plaintext\">kubectl get pvc\nkubectl get pv<\/code><\/pre>\n<p>Duket se gjith\u00e7ka \u00ebsht\u00eb n\u00eb rregull! Si duket kjo n\u00eb ceph?<br \/>\nMarrim nj\u00eb list\u00eb volumesh n\u00eb pool dhe shikojm\u00eb informacionin mbi volumin ton\u00eb:<\/p>\n<pre><code class=\"plaintext\">rbd ls -p kube\nrbd -p kube info csi-vol-eb3d257d-8c6c-11ea-bff5-6235e7640653  # k\u00ebtu, sigurisht, do t\u00eb jet\u00eb nj\u00eb ID tjet\u00ebr volumi, i cili u dha nga komanda e m\u00ebparshme<\/code><\/pre>\n<p>Tani le t\u00eb shohim se si funksionon ndryshimi i madh\u00ebsis\u00eb s\u00eb volumin RBD.<br \/>\nNdryshojm\u00eb madh\u00ebsin\u00eb e volumin n\u00eb manifestin pvc.yaml n\u00eb 2Gi dhe e aplikojm\u00eb:<\/p>\n<pre><code class=\"plaintext\">kubectl apply -f pvc.yaml<\/code><\/pre>\n<p>T\u00eb presim derisa ndryshimet t\u00eb hyjn\u00eb n\u00eb fuqi dhe t\u00eb shohim p\u00ebrs\u00ebri madh\u00ebsin\u00eb e volumin.<\/p>\n<pre><code class=\"plaintext\">rbd -p kube info csi-vol-eb3d257d-8c6c-11ea-bff5-6235e7640653\n\nkubectl get pv\nkubectl get pvc<\/code><\/pre>\n<p>Shohim se madh\u00ebsia e PVC nuk \u00ebsht\u00eb ndryshuar. P\u00ebr t\u00eb m\u00ebsuar arsyen, mund t\u00eb k\u00ebrkojm\u00eb p\u00ebr Kubernetes p\u00ebr t\u00eb p\u00ebrshkruar PVC n\u00eb formatin YAML:<\/p>\n<pre><code class=\"plaintext\">kubectl get pvc rbd-pvc -o yaml<\/code><\/pre>\n<p>Ja dhe problemi:<\/p>\n<p><em>message: Duke pritur q\u00eb p\u00ebrdoruesi t\u00eb (ri)filloj\u00eb nj\u00eb pod p\u00ebr t\u00eb p\u00ebrfunduar zmadhen e sistemit t\u00eb skedar\u00ebve t\u00eb volumit n\u00eb nod.<\/em><\/p>\n<p>K\u00ebshtu q\u00eb disku \u00ebsht\u00eb zgjeruar, por sistemi i skedar\u00ebve mbi t\u00eb \u2014 jo.<br \/>\nP\u00ebr t\u00eb zgjeruar sistemin e skedar\u00ebve, duhet t\u00eb montoni volumin. Ne kemi krijuar PVC\/PV q\u00eb tani nuk p\u00ebrdoret n\u00eb asnj\u00eb m\u00ebnyr\u00eb.<\/p>\n<p>Mund t\u00eb krijojm\u00eb nj\u00eb pod testues, p\u00ebr shembull k\u00ebshtu:<\/p>\n<pre><code class=\"plaintext\">---\napiVersion: v1\nkind: Pod\nmetadata:\n  name: csi-rbd-demo-pod\nspec:\n  containers:\n    - name: web-server\n      image: nginx:1.17.6\n      volumeMounts:\n        - name: mypvc\n          mountPath: \/data\n  volumes:\n    - name: mypvc\n      persistentVolumeClaim:\n        claimName: rbd-pvc\n        readOnly: false<\/code><\/pre>\n<p>Tani tani t\u00eb shohim PVC-n\u00eb:<\/p>\n<pre><code class=\"plaintext\">kubectl get pvc<\/code><\/pre>\n<p>Madh\u00ebsia u ndryshua, gjith\u00e7ka \u00ebsht\u00eb n\u00eb rregull.<\/p>\n<p>N\u00eb pjes\u00ebn e par\u00eb punuam me pajisjen bllok RBD (e cila do t\u00eb thot\u00eb Rados Block Device), por kjo nuk \u00ebsht\u00eb e mundur n\u00ebse nevojitet q\u00eb disa mikro-sh\u00ebrbime t\u00eb punojn\u00eb nj\u00ebkoh\u00ebsisht me k\u00ebt\u00eb disk. P\u00ebr pun\u00eb me skedar\u00eb, n\u00eb vend t\u00eb imazhit t\u00eb disku, CephFS \u00ebsht\u00eb opsioni m\u00eb i mir\u00eb.<br \/>\nDo t\u00eb konfiguroni CSI-n\u00eb dhe entitetet e tjera t\u00eb nevojshme p\u00ebr pun\u00eb me CephFS n\u00eb shembujt e klastereve Ceph dhe Kubernetes.<\/p>\n<p>T\u00eb marrim vlerat nga Helm chart-i q\u00eb na nevojitet:<\/p>\n<pre><code class=\"plaintext\">helm inspect values ceph-csi\/ceph-csi-cephfs &gt; cephfs.yml<\/code><\/pre>\n<p>S\u00ebrish \u00ebsht\u00eb e nevojshme t\u00eb plot\u00ebsoni skedarin cephfs.yml. Si m\u00eb par\u00eb, komandat Ceph do ju ndihmojn\u00eb:<\/p>\n<pre><code class=\"plaintext\">ceph fsid\nceph mon dump<\/code><\/pre>\n<p>Plot\u00ebsojm\u00eb skedarin me vlera n\u00eb k\u00ebt\u00eb m\u00ebnyr\u00eb:<\/p>\n<pre><code class=\"plaintext\">csiConfig:\n  - clusterID: \"bcd0d202-fba8-4352-b25d-75c89258d5ab\"\n    monitors:\n      - \"172.18.8.5:6789\"\n      - \"172.18.8.6:6789\"\n      - \"172.18.8.7:6789\"\n\nnodeplugin:\n  httpMetrics:\n    enabled: true\n    containerPort: 8091\n  podSecurityPolicy:\n    enabled: true\n\nprovisioner:\n  replicaCount: 1\n  podSecurityPolicy:\n    enabled: true<\/code><\/pre>\n<p>Vini re se adresat e monitor\u00ebve jepen n\u00eb form\u00ebn e thjesht\u00eb address:port. P\u00ebr montimin e cephfs n\u00eb nyj\u00eb, k\u00ebto adresa i kalohen modulit t\u00eb b\u00ebrtham\u00ebs, i cili ende nuk \u00ebsht\u00eb n\u00eb gjendje t\u00eb punoj\u00eb me protokollin e monitor\u00ebve v2.<br \/>\nNe ndryshojm\u00eb portin p\u00ebr httpMetrics (ku Prometheus do shkoj\u00eb p\u00ebr metrikat e monitorimit) p\u00ebr t\u00eb shmangur konfliktin me nginx-proxy, q\u00eb instalohet nga Kubespray. Mund t\u00eb mos e keni nevojsh\u00ebm k\u00ebt\u00eb.<\/p>\n<p>Instalojm\u00eb Helm chart-in n\u00eb klasterin Kubernetes:<\/p>\n<pre><code class=\"plaintext\">helm upgrade -i ceph-csi-cephfs ceph-csi\/ceph-csi-cephfs -f cephfs.yml -n ceph-csi-cephfs --create-namespace<\/code><\/pre>\n<p>Shkoni te ndarja e t\u00eb dh\u00ebnave Ceph p\u00ebr t\u00eb krijuar nj\u00eb p\u00ebrdorues t\u00eb ve\u00e7ant\u00eb atje. N\u00eb dokumentacion thuhet se provizioneri CephFS ka nevoj\u00eb p\u00ebr t\u00eb drejtat e administrators t\u00eb klasterit. Por ne do t\u00eb krijojm\u00eb nj\u00eb p\u00ebrdorues t\u00eb ve\u00e7ant\u00eb <em>fs<\/em> me t\u00eb drejta t\u00eb kufizuara:<\/p>\n<pre><code class=\"plaintext\">ceph auth get-or-create client.fs mon 'allow r' mgr 'allow rw' mds 'allow rws' osd 'allow rw pool=cephfs_data, allow rw pool=cephfs_metadata'<\/code><\/pre>\n<p>Dhe menj\u00ebher\u00eb do t\u00eb shikojm\u00eb \u00e7el\u00ebsin e tij t\u00eb aksesit, i cili do t\u00eb na nevojitet m\u00eb von\u00eb:<\/p>\n<pre><code class=\"plaintext\">ceph auth get-key client.fs<\/code><\/pre>\n<p>T\u00eb krijojm\u00eb nj\u00eb Secret dhe StorageClass t\u00eb ve\u00e7ant\u00eb.<br \/>\nNuk \u00ebsht\u00eb ndonj\u00eb gj\u00eb e re, ne e kemi par\u00eb k\u00ebt\u00eb n\u00eb shembujt e RBD:<\/p>\n<pre><code class=\"plaintext\">---\napiVersion: v1\nkind: Secret\nmetadata:\n  name: csi-cephfs-secret\n  namespace: ceph-csi-cephfs\nstringData:\n  # E nevojshme p\u00ebr volumin e krijuar dinamikisht\n  adminID: fs\n  adminKey:<\/code><\/pre>\n<p>Aplikoni manifestin:<\/p>\n<pre><code class=\"plaintext\">kubectl apply -f secret.yaml<\/code><\/pre>\n<p>Dhe tani - nj\u00eb StorageClass t\u00eb ve\u00e7ant\u00eb:<\/p>\n<pre><code class=\"plaintext\">---\napiVersion: storage.k8s.io\/v1\nkind: StorageClass\nmetadata:\n  name: csi-cephfs-sc\nprovisioner: cephfs.csi.ceph.com\nparameters:\n  clusterID: \n\n  # Emri i sistemit t\u00eb skedar\u00ebve CephFS, n\u00eb t\u00eb cilin do t\u00eb krijohet volumi\n  fsName: cephfs\n\n  # (opsionale) Puli Ceph, n\u00eb t\u00eb cilin do t\u00eb ruhen t\u00eb dh\u00ebnat e volumit\n  # pool: cephfs_data\n\n  # (opsionale) Opsionet e montimit p\u00ebr Ceph-fuse t\u00eb ndara me presje\n  # p.sh:\n  # fuseMountOptions: debug\n\n  # (opsionale) Opsionet e montimit CephFS p\u00ebr b\u00ebrtham\u00ebn t\u00eb ndara me presje\n  # Shihni man mount.ceph p\u00ebr nj\u00eb list\u00eb t\u00eb k\u00ebtyre opsioneve. P.sh:\n  # kernelMountOptions: readdir_max_bytes=1048576,norbytes\n\n  # Sekretet duhet t\u00eb p\u00ebrmbajn\u00eb qasje p\u00ebr adminin dhe\/ose p\u00ebrdoruesin Ceph.\n  csi.storage.k8s.io\/provisioner-secret-name: csi-cephfs-secret\n  csi.storage.k8s.io\/provisioner-secret-namespace: ceph-csi-cephfs\n  csi.storage.k8s.io\/controller-expand-secret-name: csi-cephfs-secret\n  csi.storage.k8s.io\/controller-expand-secret-namespace: ceph-csi-cephfs\n  csi.storage.k8s.io\/node-stage-secret-name: csi-cephfs-secret\n  csi.storage.k8s.io\/node-stage-secret-namespace: ceph-csi-cephfs\n\n  # (opsionale) Drejtori mund t\u00eb p\u00ebrdor\u00eb ose ceph-fuse (fuse), \n  # ose ceph kernelclient (kernel).\n  # N\u00ebse nuk p\u00ebrcaktohet, do t\u00eb p\u00ebrdoret montimi i volumit t\u00eb paracaktuar,\n  # kjo p\u00ebrcaktohet duke k\u00ebrkuar ceph-fuse dhe mount.ceph\n  # mounter: kernel\nreclaimPolicy: Delete\nallowVolumeExpansion: true\nmountOptions:\n  - debug<\/code><\/pre>\n<p>Do ta plot\u00ebsojm\u00eb k\u00ebtu <strong>clusterID<\/strong> dhe do ta aplikojm\u00eb n\u00eb Kubernetes:<\/p>\n<pre><code class=\"plaintext\">kubectl apply -f storageclass.yaml<\/code><\/pre>\n<h2 id=\"proverka\">Kontrolli<\/h2>\n<p>P\u00ebr kontroll, si n\u00eb shembullin e kaluar, do t\u00eb krijojm\u00eb nj\u00eb PVC:<\/p>\n<pre><code class=\"plaintext\">---\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: csi-cephfs-pvc\nspec:\n  accessModes:\n    - ReadWriteMany\n  resources:\n    requests:\n      storage: 5Gi\n  storageClassName: csi-cephfs-sc<\/code><\/pre>\n<p>Dhe do t\u00eb kontrollojm\u00eb pranin\u00eb e PVC\/PV:<\/p>\n<pre><code class=\"plaintext\">kubectl get pvc\nkubectl get pv<\/code><\/pre>\n<p>N\u00ebse d\u00ebshiron t\u00eb shoh\u00ebsh skedar\u00ebt dhe katalog\u00ebt n\u00eb CephFS, mund ta montosh k\u00ebt\u00eb sistem skedar\u00ebsh diku. P\u00ebr shembull, si\u00e7 tregohet m\u00eb posht\u00eb.<\/p>\n<p>Do t\u00eb shkojm\u00eb n\u00eb nj\u00eb nga nodet e klasterit Ceph dhe do t\u00eb kryejm\u00eb k\u00ebto veprime:<\/p>\n<pre><code class=\"plaintext\"># \u0422\u043e\u0447\u043a\u0430 \u043c\u043e\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f\nmkdir -p \/mnt\/cephfs\n\n# \u0421\u043e\u0437\u0434\u0430\u0451\u043c \u0444\u0430\u0439\u043b \u0441 \u043a\u043b\u044e\u0447\u043e\u043c \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0430\nceph auth get-key client.admin &gt;\/etc\/ceph\/secret.key\n\n# \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \/etc\/fstab\n# !! \u0418\u0437\u043c\u0435\u043d\u044f\u0435\u043c ip \u0430\u0434\u0440\u0435\u0441 \u043d\u0430 \u0430\u0434\u0440\u0435\u0441 \u043d\u0430\u0448\u0435\u0433\u043e \u0443\u0437\u043b\u0430\necho \"172.18.8.6:6789:\/ \/mnt\/cephfs ceph name=admin,secretfile=\/etc\/ceph\/secret.key,noatime,_netdev    0       2\" &gt;&gt; \/etc\/fstab\n\nmount \/mnt\/cephfs<\/code><\/pre>\n<p>Sigurisht, nj\u00eb montim i till\u00eb FS n\u00eb nod\u00ebn Ceph \u00ebsht\u00eb i p\u00ebrshtatsh\u00ebm vet\u00ebm p\u00ebr q\u00ebllime m\u00ebsimore, t\u00eb cilat po i ndjekim n\u00eb kursin ton\u00eb <noindex><a rel=\"nofollow\" href=\"http:\/\/slurm.io\">Slerm<\/a><\/noindex>. Nuk mendoj se dikush do ta b\u00ebnte k\u00ebt\u00eb n\u00eb prodhim, ka rrezik t\u00eb madh p\u00ebr t\u00eb fshir\u00eb rast\u00ebsisht skedar\u00eb t\u00eb r\u00ebnd\u00ebsish\u00ebm.<\/p>\n<p>Dhe p\u00ebrfundimisht, le t\u00eb kontrollojm\u00eb se si q\u00ebndron situata me ndryshimin e madh\u00ebsis\u00eb s\u00eb volumit n\u00eb rastin e CephFS. Kthehemi n\u00eb Kubernetes dhe redaktojm\u00eb manifestin ton\u00eb p\u00ebr PVC - do ta rrisim atje madh\u00ebsin\u00eb, p\u00ebr shembull, n\u00eb 7Gi.<\/p>\n<p>Do ta aplikojm\u00eb skedarin e redaktuar:<\/p>\n<pre><code class=\"plaintext\">kubectl apply -f pvc.yaml<\/code><\/pre>\n<p>Do t\u00eb shohim n\u00eb katalogun e montuar, si ka ndryshuar kuota:<\/p>\n<pre><code class=\"plaintext\">getfattr -n ceph.quota.max_bytes<\/code><\/pre>\n<p>P\u00ebr t\u00eb funksionuar k\u00ebt\u00eb komand\u00eb, ndoshta do t'ju duhet t\u00eb instaloni n\u00eb sistem paket\u00ebn <strong>attr<\/strong>.<\/p>\n<h2 id=\"glaza-boyatsya-a-ruki-delayut\">Syri friksohet, por duart punojn\u00eb<\/h2>\n<p>Me ndoshta gjith\u00e7ka k\u00ebto magji dhe manifestet e gjata YAML duken t\u00eb komplikuara, por n\u00eb praktik\u00eb student\u00ebt e Slyrm i kuptojn\u00eb ato mjaft shpejt.<br \/>\nN\u00eb k\u00ebt\u00eb artikull ne nuk shkuam n\u00eb thell\u00ebsi \u2014 p\u00ebr k\u00ebt\u00eb ka dokumentacionin zyrtar. N\u00ebse jeni t\u00eb interesuar p\u00ebr detajet e konfigurimit t\u00eb ruajtjes Ceph s\u00eb bashku me klasterin Kubernetes, k\u00ebto lidhje do t'ju ndihmojn\u00eb:<\/p>\n<p><noindex><a rel=\"nofollow\" href=\"https:\/\/kubernetes.io\/docs\/concepts\/storage\/volumes\/\">Principet e p\u00ebrgjithshme t\u00eb funksionimit t\u00eb Kubernetes me volume<\/a><\/noindex><br \/>\n<noindex><a rel=\"nofollow\" href=\"https:\/\/ceph.readthedocs.io\/en\/latest\/rbd\/\">Dokumentacioni mbi RBD<\/a><\/noindex><br \/>\n<noindex><a rel=\"nofollow\" href=\"https:\/\/docs.ceph.com\/docs\/master\/rbd\/rbd-kubernetes\/\">Integrimi i RBD dhe Kubernetes nga k\u00ebndv\u00ebshtrimi i Ceph<\/a><\/noindex><br \/>\n<noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/ceph\/ceph-csi\/blob\/master\/docs\/deploy-rbd.md\">Integrimi i RBD dhe Kubernetes nga k\u00ebndv\u00ebshtrimi i CSI<\/a><\/noindex><br \/>\n<noindex><a rel=\"nofollow\" href=\"https:\/\/ceph.readthedocs.io\/en\/latest\/cephfs\/\">Dokumentacioni i p\u00ebrgjithsh\u00ebm mbi CephFS<\/a><\/noindex><br \/>\n<noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/ceph\/ceph-csi\/blob\/master\/docs\/deploy-cephfs.md\">Integrimi i CephFS dhe Kubernetes nga k\u00ebndv\u00ebshtrimi i CSI<\/a><\/noindex><\/p>\n<p>N\u00eb kursin Slyrm <noindex><a rel=\"nofollow\" href=\"http:\/\/to.slurm.io\/6p9lng\">Kubernetes Baza<\/a><\/noindex> mund t\u00eb shkoni edhe m\u00eb tej dhe t\u00eb zhvilloni n\u00eb Kubernetes nj\u00eb aplikacion real q\u00eb do t\u00eb p\u00ebrdor\u00eb CephFS si nj\u00eb ruajt\u00ebs p\u00ebr skedar\u00ebt. N\u00ebp\u00ebrmjet k\u00ebrkesave GET\/POST mund t\u00eb d\u00ebrgoni skedar\u00eb dhe t'i merrni ato nga Ceph.<\/p>\n<p>Dhe n\u00ebse jeni m\u00eb t\u00eb interesuar p\u00ebr ruajtjen e t\u00eb dh\u00ebnave, at\u00ebher\u00eb regjistrohuni p\u00ebr <noindex><a rel=\"nofollow\" href=\"http:\/\/to.slurm.io\/WkM2Eg\">kursin e ri mbi Ceph<\/a><\/noindex>. Nd\u00ebrsa po zhvillohet testi beta, kursi mund t\u00eb merret me zbritje dhe t\u00eb ndikoni n\u00eb p\u00ebrmbajtjen e tij.<\/p>\n<p><em>Autori i artikullit: Aleksand\u00ebr Shvalov, inxhinier praktikues <noindex><a rel=\"nofollow\" href=\"http:\/\/to.slurm.io\/ophLww\">Southbridge<\/a><\/noindex>, Administrator i Certifikuar Kubernetes, autor dhe zhvillues kursesh Slyrm.<\/em><\/p>\n<p>Burimi: <a content=\"nofollow\" rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/company\/southbridge\/blog\/519642\/\">habr.com<\/a><\/p>","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"excerpt":{"rendered":"<p>Container Storage Interface (CSI) \u2014 \u044d\u0442\u043e \u0443\u043d\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f Kubernetes \u0438 \u0441\u0438\u0441\u0442\u0435\u043c \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445. \u0412\u043a\u0440\u0430\u0442\u0446\u0435 \u043e \u043d\u0451\u043c \u043c\u044b \u0443\u0436\u0435 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u043b\u0438, \u0430 \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u0432\u044f\u0437\u043a\u0443 CSI \u0438 Ceph: \u043f\u043e\u043a\u0430\u0436\u0435\u043c, \u043a\u0430\u043a \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 Ceph \u043a \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0443 Kubernetes. \u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u044b \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0435, \u0445\u043e\u0442\u044f \u0438 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0443\u043f\u0440\u043e\u0449\u0451\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0432\u043e\u0441\u043f\u0440\u0438\u044f\u0442\u0438\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u044b. \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u043e\u0432 Ceph \u0438 Kubernetes [&hellip;]<\/p>\n","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"author":1,"featured_media":94740,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[688],"tags":[],"class_list":["post-94739","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-administrirovanie"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.1.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"Container Storage Interface (CSI) \u2014 \u044d\u0442\u043e \u0443\u043d\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f Kubernetes \u0438 \u0441\u0438\u0441\u0442\u0435\u043c \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Yuri Gagarin\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/prohoster.info\/sq\/blog\/administrirovanie\/prakticheskij-primer-podklyucheniya-hranilishha-na-baze-ceph-v-klaster-kubernetes\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.1.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"sq_AL\" \/>\n\t\t<meta property=\"og:site_name\" content=\"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"\ud83e\udd47\u041f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430 \u043d\u0430 \u0431\u0430\u0437\u0435 Ceph \u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440 Kubernetes | ProHoster\" \/>\n\t\t<meta property=\"og:description\" content=\"Container Storage Interface (CSI) \u2014 \u044d\u0442\u043e \u0443\u043d\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f Kubernetes \u0438 \u0441\u0438\u0441\u0442\u0435\u043c \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/prohoster.info\/sq\/blog\/administrirovanie\/prakticheskij-primer-podklyucheniya-hranilishha-na-baze-ceph-v-klaster-kubernetes\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:width\" content=\"350\" \/>\n\t\t<meta property=\"og:image:height\" content=\"350\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2020-09-20T17:42:27+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2021-01-02T11:05:08+00:00\" \/>\n\t\t<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"\ud83e\udd47Shembulli praktik i lidhjes s\u00eb ruajtjes mbi baz\u00ebn e Ceph n\u00eb klasterin Kubernetes | ProHoster","description":"Container Storage Interface (CSI) \u00ebsht\u00eb nj\u00eb nd\u00ebrfaqe e unifikuar p\u00ebr nd\u00ebrveprimin e Kubernetes me sistemet e ruajtjes s\u00eb t\u00eb dh\u00ebnave.","canonical_url":"https:\/\/prohoster.info\/sq\/blog\/administrirovanie\/prakticheskij-primer-podklyucheniya-hranilishha-na-baze-ceph-v-klaster-kubernetes","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"sq_AL","og:site_name":"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b","og:type":"article","og:title":"\ud83e\udd47\u041f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430 \u043d\u0430 \u0431\u0430\u0437\u0435 Ceph \u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440 Kubernetes | ProHoster","og:description":"Container Storage Interface (CSI) \u2014 \u044d\u0442\u043e \u0443\u043d\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f Kubernetes \u0438 \u0441\u0438\u0441\u0442\u0435\u043c \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445.","og:url":"https:\/\/prohoster.info\/sq\/blog\/administrirovanie\/prakticheskij-primer-podklyucheniya-hranilishha-na-baze-ceph-v-klaster-kubernetes","og:image":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:secure_url":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:width":350,"og:image:height":350,"article:published_time":"2020-09-20T17:42:27+00:00","article:modified_time":"2021-01-02T11:05:08+00:00","article:publisher":"https:\/\/www.facebook.com\/prohoster","article:author":"https:\/\/www.facebook.com\/prohoster"},"aioseo_meta_data":{"post_id":"94739","title":null,"description":"","keywords":"","keyphrases":null,"primary_term":null,"canonical_url":"","og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"seo_analyzer_scan_date":null,"breadcrumb_settings":null,"limit_modified_date":false,"reviewed_by":null,"ai":null,"created":"2021-02-28 11:19:21","updated":"2022-09-30 10:03:10","focus_keyword":null,"additional_keywords":null,"truseo_locale":null},"gt_translate_keys":[{"key":"link","format":"url"}],"_links":{"self":[{"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/posts\/94739","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/comments?post=94739"}],"version-history":[{"count":0,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/posts\/94739\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/media\/94740"}],"wp:attachment":[{"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/media?parent=94739"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/categories?post=94739"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/tags?post=94739"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}