1

Hi I'm new to k8s and helm ecosystem.

I constructed my own k8s cluster using kubespray with EC2 (I can use EKS but for the purpose of practice) and the next step is using helm.

I'm trying to deploy mysql chart to my k8s cluster.

My env

# storage class manifest
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: local-storage
provisioner: kubernetes.io/no-provisioner
#volumeBindingMode: WaitForFirstConsumer
# values.yaml from mysql chart
## Persist data to a persistent volume
persistence:
  enabled: true
  ## database data Persistent Volume Storage Class
  ## If defined, storageClassName: <storageClass>
  ## If set to "-", storageClassName: "", which disables dynamic provisioning
  ## If undefined (the default) or set to null, no storageClassName spec is
  ##   set, choosing the default provisioner.  (gp2 on AWS, standard on
  ##   GKE, AWS & OpenStack)
  ##
  storageClass: "local-storage"  # <-- Changed this to use my own storage class
  accessMode: ReadWriteOnce
  size: 1Gi                      # <-- Changed this since only 2.5GB is available on each node
  annotations: {}
...

Problem

There is an error on pvc. Below is related logs.

ubuntu@nodec1:~/charts/stable/mysql$ kubectl describe pvc/mysqlserver
Name:          mysqlserver
Namespace:     default
StorageClass:  local-storage
Status:        Pending
Volume:
Labels:        app=mysqlserver
               app.kubernetes.io/managed-by=Helm
               chart=mysql-1.6.9
               heritage=Helm
               release=mysqlserver
Annotations:   meta.helm.sh/release-name: mysqlserver
               meta.helm.sh/release-namespace: default
Finalizers:    [kubernetes.io/pvc-protection]
Capacity:
Access Modes:
VolumeMode:    Filesystem
Mounted By:    mysqlserver-5d5cfcd5f8-922k4
Events:
  Type     Reason              Age               From                         Message
  ----     ------              ----              ----                         -------
  Warning  ProvisioningFailed  6s (x3 over 21s)  persistentvolume-controller  no volume plugin matched name: kubernetes.io/no-provisioner

I have no idea why pvc cannot use kubernetes.io/no-provisioner plugin from my own local-storage storageclass. Can anybody help on this issue?

0

This error means that since you are not using dynamic volume provisioner (that would automatically create a volume for you) you need to create this volume yourself

Check the k8s docs for examples how to do it: https://kubernetes.io/docs/concepts/storage/volumes/#local

Just to quicly test and to check if this is the issue you can apply the following yaml:

apiVersion: v1
kind: PersistentVolume
metadata:
  name: example-pv
spec:
  capacity:
    storage: 10Gi
  volumeMode: Filesystem
  accessModes:
  - ReadWriteOnce
  persistentVolumeReclaimPolicy: Delete
  storageClassName: local-storage
  local:
    path: /mnt/asd
  nodeAffinity:
    required:
      nodeSelectorTerms:
      - matchExpressions:
        - key: kubernetes.io/hostname
          operator: Exist
1
  • Thanks @Matt . Based on your answer, I can understand some concepts related to storageclass, pv and pvc. As you said, kubernetes.io/no-provisioner does not allocate pv automatically. Rather, I had to create my own pv manually. Thanks for your answer! – bmy4415 Jan 13 at 7:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.