k8s接入cephfs POD直接挂载

[root@k8s1 ~]#

[root@k8s1 ~]# cat cephfs3-pod.yaml

apiVersion: v1

kind: Pod

metadata:

  name: cephfs3-pod

spec:

  containers:

  - name: ceph-nginx

    image: nginx

    volumeMounts:

    - name: cephfd

      mountPath: /mnt/cephfs/data

      readOnly: false

  volumes:

  - name: cephfd

    cephfs:

      monitors:

      - ceph_mon_ip:6789

      user: admin

      secretFile: "/etc/ceph/ceph.client.admin.keyring"

      readOnly: false

[root@k8s1 ~]#

[root@k8s1 ~]# kubectl apply -f cephfs3-pod.yaml

pod/cephfs3-pod created

[root@k8s1 ~]#

[root@k8s1 ~]#

[root@k8s1 ~]# kubectl get pod|grep cephfs3

cephfs3-pod                           0/1     ContainerCreating   0          12s

[root@k8s1 ~]#

 

[root@k8s1 ~]# kubectl get pod|grep cephfs3

cephfs3-pod                           1/1     Running            0          87s

[root@k8s1 ~]#

 

 

 

[root@k8s1 ~]#

[root@k8s1 ~]#

[root@k8s1 ~]# kubectl describe pod cephfs3-pod

--------------------------------------------------------------------

 

Events:

 Type    Reason     Age        From               Message

  ----    ------     ----       ----               -------

  Normal  Scheduled  <unknown>  default-scheduler  Successfully assigned default/cephfs3-pod to k8s2

  Normal  Pulling        106s       kubelet, k8s2      Pulling image "nginx"

  Normal  Pulled         32s        kubelet, k8s2      Successfully pulled image "nginx"

  Normal  Created      31s        kubelet, k8s2      Created container ceph-nginx

  Normal  Started       31s        kubelet, k8s2      Started container ceph-nginx

[root@k8s1 ~]#

 

 

[root@k8s1 ~]#

[root@k8s1 ~]#

[root@k8s1 ~]# kubectl exec -it cephfs3-pod  /bin/bash

root@cephfs3-pod:/# df |grep cephfs

ceph-fuse             12660736  102400  12558336   1% /mnt/cephfs/data

root@cephfs3-pod:/#

root@cephfs3-pod:/#

root@cephfs3-pod:/#

root@cephfs3-pod:/#

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值