kubernetes掛載cephfs
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
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
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/27181165/viewspace-2150648/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- RBD與Cephfs
- Ceph RBD CephFS 儲存
- Kubernetes利用Volume掛載ConfigMap與Secret
- CEPH-3:cephfs功能詳解
- cephFS分散式檔案系統操作分散式
- Linux掛載--什麼是掛載Linux
- Kubernetes CNI網路外掛
- nfs掛載及開啟自動掛載NFS
- Docker 掛載Docker
- NFS掛載NFS
- CentOS7.X磁碟掛載及取消掛載CentOS
- 檔案系統的掛載 與 非掛載
- linux掛載新硬碟,開機自動掛載Linux硬碟
- ubuntu磁碟掛載Ubuntu
- 【掛載新盤】
- AIX掛載NFSAINFS
- Centos 磁碟掛載CentOS
- AIX掛載光碟AI
- 掛載mount指令
- Cephfs資料池資料物件命名規則解析物件
- linux裡掛載(mount)和取消掛載(umount)命令的使用Linux
- Kubernetes之Pod工作負載負載
- kubernetes負載感知排程負載
- C++ NFS掛載C++NFS
- liunx磁碟掛載操作
- 磁碟掛載mount,umount
- 谷歌外掛下載谷歌
- fdisk 操作及掛載
- 掛載裝置(mount)
- linux光碟掛載Linux
- Linux 掛載磁碟Linux
- linux掛載硬碟Linux硬碟
- 開機掛載磁碟
- 自動掛載 fstab
- 啟動掛載(轉)
- ecs centos 掛載磁碟CentOS
- ubuntu 掛載新硬碟Ubuntu硬碟
- Kubernetes:服務與負載均衡負載