[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:/#

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐