0
点赞
收藏
分享

微信扫一扫

K8S使用CephFS进行数据持久化


K8S结合CephFS使用

在​​ceph​​查看密钥

ceph auth get-key client.admin |base64

在k8s-master上面创建secret

#vim ceph-secret.yaml
apiVersion: v1
kind: Secret
metadata:
name: ceph-secret
data:
key: QVFDa2R0cGhiZlZXRWhBQVd3VDAxWnl5OWlaU3BWN3NlcTk3bWc9PQ==

创建PV

#vim pv.yaml
apiVersion: v1
kind: PersistentVolume
metadata:
name: cephfs-pv
labels:
pv: cephfs-pv
spec:
capacity:
storage: 1Gi
accessModes:
- ReadWriteMany
cephfs:
monitors:
- 10.66.66.106:6789
user: admin
secretRef:
name: ceph-secret
readOnly: false
persistentVolumeReclaimPolicy: Delete

创建PVC

#vim PVC.yaml
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: cephfs-pvc
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 1Gi
selector:
matchLabels:
pv: cephfs-pv

创建测试pod

#vim nginx-pod.yaml
apiVersion: v1
kind: Pod
metadata:
name: nginx-pod1
labels:
name: nginx-pod1
spec:
containers:
- name: nginx-pod1
image: nginx:alpine
ports:
- name: web
containerPort: 80
volumeMounts:
- name: cephfs-pvc
mountPath: /usr/share/nginx/html
volumes:
- name: cephfs-pvc
persistentVolumeClaim:
claimName: cephfs-pvc


举报

相关推荐

0 条评论