* spec.accessModes: Required value: at least 1 access mode is required

0 votes

Hi Guys,

I am trying to create one persistent volume in kubernetes. But it shows me the below error.

$ kubectl create -f pv.yml
* spec.accessModes: Required value: at least 1 access mode is required

I have written one yml file as shown below.

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: pv1
  labels:
    name: pv1
spec:
  resources:
    requests:
      storage: 2Gi
May 22 in Kubernetes by akhtar
• 11,250 points
20 views

1 answer to this question.

0 votes

Hi@akhtar,

To create persistent volume, you have to specify your access modes. It means the volume has read only access or read & write access. For that you can use one keyword accessModes inside spec.

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: pv1
  labels:
    name: pv1
spec:
  accessModes:
  - ReadWriteOnce   
  resources:
    requests:
      storage: 2Gi

Hope this is helpful.

answered May 22 by MD
• 24,500 points

Related Questions In Kubernetes

0 votes
1 answer

Is it possible to access GCP resources using api without a user interaction.?

yes that's totally possible. You'd have to create ...READ MORE

answered Sep 19, 2018 in Kubernetes by Kalgi
• 51,850 points
69 views
0 votes
2 answers
0 votes
1 answer
0 votes
1 answer
0 votes
3 answers

Error while joining cluster with node

Hi Kalgi after following above steps it ...READ MORE

answered Jan 17, 2019 in Others by anonymous
6,640 views
+4 votes
1 answer

Installing Web UI (Dashboard):kubernetes-dashboard on main Ubuntu 16.04.6 LTS (Xenial Xerus) server

Follow these steps: $ kubeadm reset $ kubeadm init ...READ MORE

answered Apr 11, 2019 in Kubernetes by Kalgi
• 51,850 points

reshown Apr 12, 2019 by Kalgi 1,971 views