嗨,我是 k8s 和 helm 生态系统的新手。
我使用 kubespray 和 EC2 构建了自己的 k8s 集群(我可以使用 EKS,但出于练习的目的),下一步是使用 helm。
我正在尝试将 mysql 图表部署到我的 k8s 集群。
我的环境
- k8s集群有1个master和3个节点(都是ec2 t2.small实例)
- 使用来自https://github.com/helm/charts/tree/master/stable/mysql的 mysql 图表
# 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: {}
...
问题
pvc有错误。以下是相关日志。
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
我不知道为什么 pvc 不能使用kubernetes.io/no-provisioner
我自己的存储类中的插件local-storage
。有人可以帮助解决这个问题吗?