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, 2020 in Kubernetes by akhtar
• 38,260 points
3,461 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, 2020 by MD
• 95,460 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
• 52,350 points
706 views
0 votes
2 answers
0 votes
1 answer

How to deploy at least one pod per minion while configuring replication controller?

I think what you actually want to ...READ MORE

answered Nov 23, 2018 in Kubernetes by ajs3033
• 7,300 points
857 views
+1 vote
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
15,476 views
0 votes
1 answer

permissions related to AWS ECR

if you add allowContainerRegistry: true, kops will add those permissions ...READ MORE

answered Oct 9, 2018 in Kubernetes by Kalgi
• 52,350 points
1,396 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP