26
loading...
This website collects cookies to deliver better user experience
.spec.volumes
and is mounted to containers by specifying in .spec.containers[*].volumeMounts.
Kubernetes supports different types of volumes depending on the medium hosting them and their contents. There are two main classes of volumes:apiVersion: v1
kind: PersistentVolume
metadata:
name: darwin-volume
labels:
type: local
spec:
storageClassName: dev
capacity:
storage: 10Gi
accessModes:
- ReadWriteMany
hostPath:
path: "/mnt/data"
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: darwin-claim
spec:
storageClassName: dev
accessModes:
- ReadWriteMany
resources:
requests:
storage: 3Gi
spec:
volumes:
- name: darwin-storage
persistentVolumeClaim:
claimName: darwin-claim
containers:
- name: darwin-container
image: nginx
ports:
- containerPort: 80
kubectl apply
command, the Kubernetes Master Node searches for a PV that meets the requirements listed by the claim. If an appropriate PV exists with the same storageClassName
specification, the PV is bound to the volume.storageClass
resource, cluster administrators can describe the different flavors of storage on offer, mapping to different quality-of-service levels or security policies. The storageClass
resource is defined using three main specifications:26