In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
Today, I will talk to you about how to use StorageClass to bind ceph rbd in kubernetes. Many people may not know much about it. In order to make you understand better, the editor summarized the following content for you. I hope you can get something according to this article.
Create a k8s storage pool to store data volumes
# ceph osd pool create k8s 64 64
Create a cephx user to mount the rbd created by admin
# ceph auth get-or-create client.k8s mon 'allow r' osd 'allow * pool=k8s'
3. Obtain the key of K8s users and encode it with base64
# ceph auth get-key client.k8s | base64
Record the output, such as QVFEQjlmcFpjUE5lS0JBQU40NnZxZ2dIT0dRTEtaeUx1blNjR1E9PQ==
4. Obtain the key of the admin user and encode it with base64
# ceph auth get-key client.admin | base64
Record the output, such as QVFDUDNrQllRRVBJR0JBQXFuVXJQbHZQaC9xZEQ2ZGVZOXRoVXc9PQ==
5. Create storage-class-rbd.yaml
-apiVersion: v1data: key: QVFEQjlmcFpjUE5lS0JBQU40NnZxZ2dIT0dRTEtaeUx1blNjR1E9PQ==kind: Secretmetadata: name: ceph-secret-user namespace: defaulttype: kubernetes.io/rbd---apiVersion: v1data: key: QVFDUDNrQllRRVBJR0JBQXFuVXJQbHZQaC9xZEQ2ZGVZOXRoVXc9PQ==kind: Secretmetadata: name: ceph-secret-admin namespace: kube-systemtype: kubernetes.io/rbd---apiVersion: storage.k8s.io/v1kind: StorageClassmetadata: name: rbdprovisioner: kubernetes.io/rbdparameters: monitors: 192.168.1.1 Admin adminSecretName: ceph-secret-admin adminSecretNamespace: kube-system pool: K8s userId: K8s userSecretName: ceph-secret-user fsType: xfs imageFormat: "2" imageFeatures: "layering"
VI. Create StorageClass
# kubectl create-f. / storage-class-rbd.yaml
7. Create a nginx-statefulset.yaml and mount the volume dynamically through StatefulSet
-apiVersion: apps/v1beta1kind: StatefulSetmetadata: name: webspec: serviceName: "nginx" replicas: 2 volumeClaimTemplates:-metadata: annotations: volume.beta.kubernetes.io/storage-class: "rbd" # here configure the name of the storageclass created above spec: accessModes: ["ReadWriteOnce"] resources: requests: storage: 2Gi template: metadata: Labels: app: nginx spec: containers:-name: nginx image: nginx:latest volumeMounts:-mountPath: "/ usr/share/nginx/html/" name: html
StatefulSet creates an rbd data volume for each Pod and mounts it to the / usr/share/nginx/html/ directory, which is dynamically created and destroyed as the StatefulSet scales.
After reading the above, do you have any further understanding of how to bind ceph rbd with StorageClass in kubernetes? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.