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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值