Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

227
Visualizações
Persistent Volume Issue on GKE

So I am trying to create a persistent volume on GKE with the definition below:


apiVersion: v1
kind: PersistentVolume
metadata:
  name: pv01-3gi
  labels:
    env: prod
spec:
  capacity:
    storage: 5Gi
  accessModes:
    - 'ReadWriteOnce'
  storageClassName: standard

However when I try to apply this, I get the error message shown below:

➜ kubectl apply -f pv-1.yaml
The PersistentVolume "pv01-3gi" is invalid: spec: Required value: must specify a volume type

My understanding is that the volume type is indicated by the storage class which is set to standard (which is a default storage class offered by GKE


➜ kubectl get storageclass
NAME                 PROVISIONER            AGE
standard (default)   kubernetes.io/gce-pd   16d

What am I doing wrong?

over 4 years ago · Santiago Trujillo
3 Respostas
Responde à pergunta

0

Please note that Storage Classes on directly provisioned Persistent Volumes only serve the purpose to make it possible to reference those volumes via Persistent Volume Claims!

The intention here is that a system administrator sets up a bunch of Persistent Volumes and deals with the details of referencing hard drive devices outside of the cluster. Then an application developer can reference those volumes via Persistent Volume Claims, by stating figuratively speaking: "Please find me a volume of StorageClass SSD with at least 5GB storage".

In other words, if you create a PV directly, please make sure you provide the exact configuration including the reference to the physical storage device.

over 4 years ago · Santiago Trujillo Relatório

0

If using a dynamic provisioner, there is no need to create the PV on your own.

Just create a PVC with storage class and GKE will automatically provide the PV with the requested storage size.

kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: ssd-storage
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 10
  storageClassName: ssd
over 4 years ago · Santiago Trujillo Relatório

0

you are missing the volume type in spec. for example, i have added nfs type here.

apiVersion: v1
kind: PersistentVolume
metadata:
  name: pv01-3gi
  labels:
    env: prod
spec:
  capacity:
    storage: 5Gi
  accessModes:
    - ReadWriteOnce
  storageClassName: standard
  volumeMode: Filesystem
  nfs: 
    path: /opt/nfs 
    server: nfs.f22 
    readOnly: false
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda