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,328 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,360 points
632 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
814 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,299 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 12, 2019 in Kubernetes by Kalgi
• 52,360 points

reshown Apr 12, 2019 by Kalgi 6,923 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