标签:编辑 policy ada font 添加 exp img ora ash
1、模板定义
修改OpenShift自带模板
[root@master1 pv]# oc edit template redis-persistent
添加如下:
2、创建PV
编辑redis pv json文件
[root@master1 pv]# cat data_redis.json { "apiVersion": "v1", "kind": "PersistentVolume", "metadata": { "name": "redis" }, "spec": { "capacity": { "storage": "2Gi" }, "accessModes": [ "ReadWriteOnce" ], "nfs": { "path": "/export/pv/data_redis", "server": "192.168.10.110" }, "persistentVolumeReclaimPolicy": "Retain" } }
创建对应目录
[root@master1 pv]# mkdir /export/pv/data_redis [root@master1 pv]# chown -R nfsnobody:nfsnobody !$ [root@master1 pv]# vim /etc/exports [root@master1 pv]# cat !$ cat /etc/exports /export/pv/docker_registry/ *(rw,sync,all_squash) /export/pv/data_redis/ *(rw,sync,all_squash) [root@master1 pv]# exportfs -r [root@master1 pv]# systemctl reload nfs-server
创建pv以及手动label
[root@master1 pv]# oc create -f data_redis.json persistentvolume "redis" created [root@master1 pv]# oc label pv redis disktype=data_redis persistentvolume "redis" labeled [root@master1 pv]# oc get pv --show-labels NAME CAPACITY ACCESSMODES RECLAIMPOLICY STATUS CLAIM STORAGECLASS REASON AGE LABELS redis 2Gi RWO Retain Available 1m disktype=data_redis registrypv 100Gi RWO Retain Bound default/docker-registry-claim 14h disktype=registry
3、创建Redis pod
登录控制台-选择要部署的project-点击Add to Project - Browse Catalog
选择所使用的pv的label
点击create即可
4、查看pod
OpenShift实战(三):OpenShift持久化存储Redis
标签:编辑 policy ada font 添加 exp img ora ash
原文地址:https://www.cnblogs.com/dukuan/p/8747907.html