Get the App
SLTechnology News&Howtos  ›  Servers  › 

K8s storageclass code example demonstration

Shulou Source: shulou.com Published: 2022-06-03 06:27:59 10月02日 Update

Today, the editor will bring you an article showing an example of K8s storageclass. The editor thinks it's pretty good, so I'll share it for you as a reference. Let's follow the editor and have a look.

Code

ApiVersion: v1kind: ServiceAccountmetadata: name: nfs-client-provisioner---kind: DeploymentapiVersion: extensions/v1beta1metadata: name: nfs-client-provisionerspec: replicas: 1 strategy: type: Recreate template: metadata: labels: app: nfs-client-provisionerspec: serviceAccount: nfs-client-provisioner containers:-name: nfs-client-provisioner image: registry.cn-hangzhou.aliyuncs.com/open-ali/nfs-client -provisioner volumeMounts:-name: nfs-client-root mountPath: / persistentvolumes env:-name: PROVISIONER_NAME value: hequan.com/nfs-name: NFS_SERVER value: 192.168.100.111-name: NFS_PATH value: / data1 volumes: -name: nfs-client-root nfs: server: 192.168.100.111 path: / data1vim clusterrole.yamlkind: ClusterRoleapiVersion: rbac.authorization.k8s.io/v1metadata: nfs-provisioner-runnerrules:-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: ["watch", "create", "update", "patch"]-apiGroups: [""] resources: ["services" "endpoints"] verbs: ["get"]-apiGroups: ["extensions"] resources: ["podsecuritypolicies"] resourceNames: ["nfs-provisioner"] verbs: ["use"] vim clusterrolebinding.yamlkind: ClusterRoleBindingapiVersion: rbac.authorization.k8s.io/v1metadata: name: run-nfs-provisionersubjects:-kind: ServiceAccount name: nfs-client-provisioner namespace: defaultroleRef: kind: ClusterRole name: nfs-provisioner-runner apiGroup: rbac.authorization.k8s. Iokind: StorageClassapiVersion: storage.k8s.io/v1metadata: name: nfsprovisioner: hequan.com/nfsparameters: archiveOnDelete: "false" test

Kind: PersistentVolumeClaim

ApiVersion: v1metadata: name: test-claim annotations: volume.beta.kubernetes.io/storage-class: "nfs" spec: accessModes:-ReadWriteMany resources: requests: storage: 1Mi

The above is the code example of K8s storageclass, the content is more comprehensive, and I also believe that there are some knowledge points that we may see or use in our daily work. Through this article, I hope you can gain more.

Tags: Code examples yes for this content that is articles daily work more see knowledge knowledge points articles references work testing Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi Shulou Technology Docker Shulou Information Huawei