【K8s教程】使用內建製備器建立RBD儲存類說明
阿新 • • 發佈:2021-08-13
參考:
建立儲存金鑰
kubectl create secret generic ceph-secret --type="kubernetes.io/rbd" \
--from-literal=key='QVFEQ1pMdFhPUnQrSmhBQUFYaERWNHJsZ3BsMmNjcDR6RFZST0E9PQ==' \
--namespace=kube-system
或者:
ceph auth get-key client.admin > ./secret kubectl create secret generic ceph-secret --from-file=./secret --namespace=kube-system
準備帶有rbd客戶端的hyperkube映象替換kube-controller-manager映象
可以使用阿里雲的海外構建結合GitHub製作hyperkube映象:
FROM k8s.gcr.io/hyperkube:v1.16.2
MAINTAINER varden
特別注意:叢集所有節點也必須安裝rbd客戶端。
部署清單
apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: fast provisioner: kubernetes.io/rbd parameters: monitors: 10.16.153.105:6789,10.16.153.106:6789 adminId: kube adminSecretName: ceph-secret adminSecretNamespace: kube-system pool: kube userId: kube userSecretName: ceph-secret-user userSecretNamespace: default fsType: ext4 imageFormat: "2" imageFeatures: "layering" reclaimPolicy: Retain
簡單使用測試
作者:Varden 出處:http://www.cnblogs.com/varden/ 本文內容如有雷同,請聯絡作者! 本文版權歸作者和部落格園共有,歡迎轉載,但未經作者同意必須保留此段宣告,且在文章頁面明顯位置給出原文連線,否則保留追究法律責任的權利。kind: PersistentVolumeClaim apiVersion: v1 metadata: name: rbd-pvc spec: storageClassName: fast accessModes: - ReadWriteOnce resources: requests: storage: 2Gi --- kind: Pod apiVersion: v1 metadata: name: rbd-test-pod spec: containers: - name: rbd-test-pod image: nginx volumeMounts: - name: pvc mountPath: "/mnt" volumes: - name: pvc persistentVolumeClaim: claimName: rbd-pvc