1 生成ceph-secret
cat /etc/ceph/ceph.client.admin.keyring
[client.admin]
key = AQDlG99ZVJhfExAAFVT/ttJBgqOKcyY5INX5Cw==
将key base64处理
echo "AQDlG99ZVJhfExAAFVT/ttJBgqOKcyY5INX5Cw=="|base64
QVFEbEc5OVpWSmhmRXhBQUZWVC90dEpCZ3FPS2N5WTVJTlg1Q3c9PQo=
2 创建secret
cat ceph-secret.yml
apiVersion: v1
kind: Secret
metadata:
name: ceph-secret
data:
key: QVFEbEc5OVpWSmhmRXhBQUZWVC90dEpCZ3FPS2N5WTVJTlg1Q3c9PQo=
3 创建pvc
cat ceph-pvc.yml
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: cephfs
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 8Gi
4 创建pv
cat ceph-pv.yml
apiVersion: v1
kind: PersistentVolume
metadata:
name: cephfs
spec:
capacity:
storage: 10Gi
accessModes:
- ReadWriteMany
cephfs:
monitors:
- 192.168.100.96:6789
path: /
user: admin
secretRef:
name: ceph-secret
5 创建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
依次创建secret,pvc,pv,RC
kubectl create -f ceph-secret.yml
kubectl create -f ceph-pvc.yml
kubectl create -f ceph-pv.yml
kubectl create -f app-rc.yaml
查看创建的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
文章名称:kubernetes挂载cephfs-创新互联
分享链接:https://www.cdcxhl.com/article10/csjpdo.html
成都网站建设公司_创新互联,为您提供品牌网站建设、企业网站制作、网站建设、网站收录、品牌网站设计、自适应网站
广告
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源:
创新互联