The PersistentVolumeClaim Pvc-volume is invalid metadata name Invalid value Pvc-volume a DNS-1123 subdomain must consist of lower case alphanumeric characters

0 votes

Hi Guys,

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

$ kubectl apply -f pvc.yml
The PersistentVolumeClaim "Pvc-volume" is invalid: metadata.name: Invalid value: "Pvc-volume": a DNS-1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')

Here I have created one yml file as given below.

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: Pvc-volume
  labels:
    name: Pvc-volume
spec:
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 3Gi
May 22, 2020 in Kubernetes by akhtar
• 38,260 points
2,730 views

1 answer to this question.

0 votes

Hi@akhtar,

when you write yml code in kubernetes, you can't use capital letters in name and labels keyword. In above code, you have written Pod-volume in name and label section. So you have to change this value.

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: pvc-volume
  labels:
    name: pvc-volume
spec:
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 3Gi
answered May 22, 2020 by MD
• 95,460 points

Related Questions In Kubernetes

0 votes
1 answer

How to determine what is the status of a deployment ?

You could use kubectl get deployment <deployment>.  If ...READ MORE

answered Jul 12, 2019 in Kubernetes by Sirajul
• 59,230 points
679 views
0 votes
1 answer

Increasing the shm size of a kubernetes container

You cannot achieve this in kubernetes pod. READ MORE

answered Sep 12, 2018 in Kubernetes by ajs3033
• 7,300 points
8,008 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,572 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,428 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