亚洲精品中文免费|亚洲日韩中文字幕制服|久久精品亚洲免费|一本之道久久免费

<optgroup id="cczp1"><ruby id="cczp1"><cite id="cczp1"></cite></ruby></optgroup>
  • <acronym id="cczp1"></acronym>
    <acronym id="cczp1"><option id="cczp1"><ol id="cczp1"></ol></option></acronym>
    <delect id="cczp1"></delect>
    <center id="cczp1"></center>
    <delect id="cczp1"></delect><em id="cczp1"><button id="cczp1"><blockquote id="cczp1"></blockquote></button></em>
    1. <optgroup id="cczp1"><td id="cczp1"><dfn id="cczp1"></dfn></td></optgroup>

      kubernetes配置安裝nfs

      系統(tǒng):centos7

      kubernetes:v1.19

      1、準(zhǔn)備nfs-server

      選擇一臺服務(wù)器安裝nfs-server

      $ yum -y install nfs-utils rpcbind

      修改nfs-server的配置

      $ mkdir -p /data/nfs$ chmod 0755 /data/nfs$ echo “/data/nfs 172.30.32.0/22(rw,no_root_squash,no_all_squash,sync)” >> /etc/exports

      參數(shù)有:

      • rw、ro:該目錄分享權(quán)限是可讀寫(read-write)或只讀(read-only)
      • sync、async:sync代表數(shù)據(jù)會同步寫入到內(nèi)存和硬盤中,async表示數(shù)據(jù)會暫存在內(nèi)存,而非直接寫入硬盤
      • no_root_squash、root_squash:客戶端root的身份會由root_squash的設(shè)定壓縮成nfsnobody。如果想開放客戶端使用root身份來操作服務(wù)器的文件系統(tǒng),需要開啟no_root_squash
      • no_all_squash、all_squash:客戶端的身份被壓縮成nobody(nfsnobody),如果想開放客戶端使用者身份,需要開啟no_all_squash
      • anonuid、anongid:anno是anonymous(匿名者),uid和gid是用戶id和組id,設(shè)置目錄的權(quán)限

      然后使配置生效

      $ exportfs -r$ systemctl enable rpcbind$ systemctl enable nfs-server

      查看掛載情況

      $ showmount -e localhostExport list for localhost:/data/nfs 172.30.32.0/22

      2、在kubernetes上安裝nfs-client

      在所有節(jié)點(diǎn)安裝nfs客戶端

      $ yum -y install nfs-utils$ showmount -e 172.30.33.193Export list for 172.30.33.193:/data/nfs 172.30.32.0/22

      此時(shí)在另一臺服務(wù)器上已經(jīng)可以查看到nfs掛載的目錄。

      helm安裝nfs-client

      $ helm repo add nfs-subdir-external-provisioner https://kubernetes-sigs.github.io/nfs-subdir-external-provisioner/$ helm install -n kube-system nfs-client nfs-subdir-external-provisioner/nfs-subdir-external-provisioner –set nfs.server=172.30.33.193 –set nfs.path=/data/nfs –set storageClass.defaultClass=true $ helm list -n kube-systemNAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSIONnfs-client kube-system 1 2022-06-13 16:56:00.304704446 +0800 CST deployed nfs-subdir-external-provisioner-4.0.11 4.0.2

      查看storageclass

      $ kubectl get scNAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGEnfs-client (default) cluster.local/nfs-client-nfs-client-provisioner Delete Immediate false 18h

      已經(jīng)安裝完畢,申請pvc時(shí)會通過storageclass自動申請pv

      $ cat pvc.yamlapiVersion: v1kind: PersistentVolumeClaimmetadata: name: pvc1spec: accessModes: – ReadWriteMany resources: requests: storage: 100Mi$ kubectl apply -f pvc.yamlpersistentvolumeclaim/pvc1 created$ kubectl get pvcNAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGEpvc1 Bound pvc-c2c45851-c843-4198-9dec-ed5f66308e93 100Mi RWX nfs-client 4s$ # kubectl get pvc pvc1 -o yamlapiVersion: v1kind: PersistentVolumeClaimspec: accessModes: – ReadWriteMany resources: requests: storage: 100Mi storageClassName: nfs-client volumeMode: Filesystem volumeName: pvc-c2c45851-c843-4198-9dec-ed5f66308e93status: accessModes: – ReadWriteMany capacity: storage: 100Mi phase: Bound

      可以看到pvc已經(jīng)綁定了storageClassName

      鄭重聲明:本文內(nèi)容及圖片均整理自互聯(lián)網(wǎng),不代表本站立場,版權(quán)歸原作者所有,如有侵權(quán)請聯(lián)系管理員(admin#wlmqw.com)刪除。
      用戶投稿
      上一篇 2022年6月19日 09:12
      下一篇 2022年6月19日 09:12

      相關(guān)推薦

      聯(lián)系我們

      聯(lián)系郵箱:admin#wlmqw.com
      工作時(shí)間:周一至周五,10:30-18:30,節(jié)假日休息