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,230 points
2,249 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,440 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
472 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
7,491 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
14,593 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,077 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