Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Kubernetes mount cephfs

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

1 generate ceph-secret

Cat / etc/ceph/ceph.client.admin.keyring

[client.admin]

Key = AQDlG99ZVJhfExAAFVT/ttJBgqOKcyY5INX5Cw==

Deal with key base64

Echo "AQDlG99ZVJhfExAAFVT/ttJBgqOKcyY5INX5Cw==" | base64

QVFEbEc5OVpWSmhmRXhBQUZWVC90dEpCZ3FPS2N5WTVJTlg1Q3c9PQo=

2 create secret

Cat ceph-secret.yml

ApiVersion: v1

Kind: Secret

Metadata:

Name: ceph-secret

Data:

Key: QVFEbEc5OVpWSmhmRXhBQUZWVC90dEpCZ3FPS2N5WTVJTlg1Q3c9PQo=

3 create pvc

Cat ceph-pvc.yml

Kind: PersistentVolumeClaim

ApiVersion: v1

Metadata:

Name: cephfs

Spec:

AccessModes:

-ReadWriteMany

Resources:

Requests:

Storage: 8Gi

4 create pv

Cat ceph-pv.yml

ApiVersion: v1

Kind: PersistentVolume

Metadata:

Name: cephfs

Spec:

Capacity:

Storage: 10Gi

AccessModes:

-ReadWriteMany

Cephfs:

Monitors:

-192.168.100.96pur6789

Path: /

User: admin

SecretRef:

Name: ceph-secret

5 create RC

Cat app-rc.yaml

ApiVersion: v1

Kind: ReplicationController

Metadata:

Name: rc-fish

Labels:

Name: fish

Spec:

Replicas: 1

Template:

Metadata:

Labels:

App: fish

Spec:

Containers:

-name: fish

Image: registry:5000/fish:7.5

ImagePullPolicy: IfNotPresent

Ports:

-containerPort: 80

Protocol: TCP

Resources:

Limits:

Cpu: 100m

Memory: 128Mi

VolumeMounts:

-name: cephfs

MountPath: / var/log/nginx

Volumes:

-name: cephfs

PersistentVolumeClaim:

ClaimName: cephfs

Create a secret,pvc,pv,RC in turn

Kubectl create-f ceph-secret.yml

Kubectl create-f ceph-pvc.yml

Kubectl create-f ceph-pv.yml

Kubectl create-f app-rc.yaml

View the created secret,pvc,pv

Root@mon2:~# kubectl get secrets

NAME TYPE DATA AGE

Ceph-secret Opaque 1 3d

Default-token-50p5c kubernetes.io/service-account-token 3 3d

Root@mon2:~# kubectl get pvc

NAME STATUS VOLUME CAPACITY ACCESSMODES STORAGECLASS AGE

Cephfs Bound cephfs 10Gi RWX 3d

Root@mon2:~# kubectl get pv

NAME CAPACITY ACCESSMODES RECLAIMPOLICY STATUS CLAIM STORAGECLASS REASON AGE

Cephfs 10Gi RWX Retain Bound default/cephfs 3d

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report