cat nfs-rbac.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
name: nfs-client-provisioner
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: nfs-client-provisioner-clusterrole
rules:
- apiGroups: [""]
resources: ["persistentvolumes"]
verbs: ["get", "list", "watch", "create", "delete"]
- apiGroups: [""]
resources: ["persistentvolumeclaims"]
verbs: ["get", "list", "watch", "update"]
- apiGroups: ["storage.k8s.io"]
resources: ["storageclasses"]
verbs: ["get", "list", "watch"]
- apiGroups: [""]
resources: ["events"]
verbs: ["list", "watch", "create", "update", "patch"]
- apiGroups: [""]
resources: ["endpoints"]
verbs: ["create", "delete", "get", "list", "watch", "patch", "update"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: nfs-client-provisioner-clusterrolebinding
subjects:
- kind: ServiceAccount
name: nfs-client-provisioner
namespace: default
roleRef:
kind: ClusterRole
name: nfs-client-provisioner-clusterrole
apiGroup: rbac.authorization.k8s.io
Kubectl apply -f nfs-rbac.yaml
cat nfs-deployment.yaml
```
apiVersion: apps/v1
kind: Deployment
metadata:
name: nfs-client-prosioner
spec:
selector:
matchLabels:
app: nfs-client-prosioner
replicas: 1
strategy:
type: Recreate
template:
metadata:
labels:
app: nfs-client-prosioner
spec:
serviceAccountName: nfs-client-provisioner
containers:
- name: nfs-client-prosioner
image: registry.cn-hangzhou.aliyuncs.com/rookieops/nfs-client-provisioner:v0.1
imagePullPolicy: IfNotPresent
volumeMounts:
- name: nfs-client-root
mountPath: /data/pv
env:
- name: PROVISIONER_NAME
value: rookieops/nfs
- name: NFS_SERVER
value: 192.168.16.1
- name: NFS_PATH
value: /home/nfs #nfs的共享目錄
volumes:
- name: nfs-client-root
nfs:
server: 192.168.16.1
path: /home/nfs
cat storageclass-naf.yaml
```
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: nfs-client-storageclass
provisioner: rookieops/nfs
```
cat pvc.yaml
```
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: test-nfs-pvc2
annotations:
volume.beta.kubernetes.io/storage-class: "nfs-client-storageclass"
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 300Gi
```
更多精彩干貨分享
點(diǎn)擊下方名片關(guān)注
IT那活兒
文章版權(quán)歸作者所有,未經(jīng)允許請(qǐng)勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。
轉(zhuǎn)載請(qǐng)注明本文地址:http://m.hztianpu.com/yun/129784.html
摘要:有狀態(tài)集群服務(wù),與普通有狀態(tài)服務(wù)相比,它多了集群管理的需求。為此開(kāi)發(fā)了一套以為核心的全新特性,方便了有狀態(tài)集群服務(wù)在上的部署和管理。 2016年12月2日,時(shí)速云架構(gòu)師張壽紅應(yīng)邀參加ArchSummit2016全球架構(gòu)師峰會(huì),并在微服務(wù)與容器實(shí)踐專(zhuān)場(chǎng)做了《Kubernetes有狀態(tài)集群服務(wù)部署與管理》的干貨分享。 showImg(https://segmentfault.com/img...
摘要:作者,高級(jí)軟件工程師實(shí)施的容器存儲(chǔ)接口已在版本中升級(jí)為。功能受棄用政策保護(hù)。隨著容器存儲(chǔ)接口的采用,卷層變得真正可擴(kuò)展。年中國(guó)論壇提案征集現(xiàn)已開(kāi)放論壇讓用戶開(kāi)發(fā)人員從業(yè)人員匯聚一堂,面對(duì)面進(jìn)行交流合作。 showImg(https://segmentfault.com/img/bVbnBe1?w=620&h=340); 作者:Saad Ali,Google高級(jí)軟件工程師 Kuberne...
摘要:作者,高級(jí)軟件工程師實(shí)施的容器存儲(chǔ)接口已在版本中升級(jí)為。功能受棄用政策保護(hù)。隨著容器存儲(chǔ)接口的采用,卷層變得真正可擴(kuò)展。年中國(guó)論壇提案征集現(xiàn)已開(kāi)放論壇讓用戶開(kāi)發(fā)人員從業(yè)人員匯聚一堂,面對(duì)面進(jìn)行交流合作。 showImg(https://segmentfault.com/img/bVbnBe1?w=620&h=340); 作者:Saad Ali,Google高級(jí)軟件工程師 Kuberne...
摘要:創(chuàng)建當(dāng)前存儲(chǔ)卷支持類(lèi)型的以及,詳見(jiàn)在中使用在中使用創(chuàng)建在創(chuàng)建持久化存儲(chǔ)卷之前,你需要先創(chuàng)建,然后在中使用。集群默認(rèn)創(chuàng)建了兩個(gè),你也可以創(chuàng)建一個(gè)新的,示例及說(shuō)明如下版本年月日之后創(chuàng)建的集群存儲(chǔ)供應(yīng)方,此處不可更改。創(chuàng)建PVC當(dāng)前存儲(chǔ)卷支持SSD、SATA類(lèi)型的UDisk以及UFS,詳見(jiàn):在UK8S中使用UDisk在UK8S中使用UFS創(chuàng)建StorageClass在創(chuàng)建持久化存儲(chǔ)卷(persis...
摘要:如果我們的容器使用,文件如下在這個(gè)例子中,我們可以重復(fù)創(chuàng)建和銷(xiāo)毀,同一個(gè)持久存儲(chǔ)會(huì)被提供給新的,無(wú)論容器位于哪個(gè)節(jié)點(diǎn)上。 前言 臨時(shí)性存儲(chǔ)是容器的一個(gè)很大的買(mǎi)點(diǎn)。根據(jù)一個(gè)鏡像啟動(dòng)容器,隨意變更,然后停止變更重啟一個(gè)容器。你看,一個(gè)全新的文件系統(tǒng)又誕生了。 在docker的語(yǔ)境下: # docker run -it centos [root@d42876f95c6a /]# echo H...
閱讀 1464·2023-01-11 13:20
閱讀 1816·2023-01-11 13:20
閱讀 1267·2023-01-11 13:20
閱讀 2009·2023-01-11 13:20
閱讀 4228·2023-01-11 13:20
閱讀 2889·2023-01-11 13:20
閱讀 1489·2023-01-11 13:20
閱讀 3814·2023-01-11 13:20