我正在尝试在我的单节点集群上部署一个mysql实例,但它仍处于挂起状态。
kubectl describe pod mysql-59777f9bf8-ghnss
.....
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Warning FailedScheduling 3m (x125 over 38m) default-scheduler pod has unbound PersistentVolumeClaims
如果我试着描述pvc,我会得到
kubectl describe pvc mysql
...
Type Reason Age From Message
---- ------ ---- ---- -------
Normal FailedBinding 4m (x143 over 39m) persistentvolume-controller no persistent volumes available for this claim and no storage class is set
如果我试图获得storageClasses,我会得到
kubectl get storageclass
No resources found.
我在Azure机器上使用kubernetes而不是Docker(Docker版本18.05.0-ce,build f150324)
$ kubectl version
Client Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.4", GitCommit:"5ca598b4ba5abb89bb773071ce452e33fb66339d", GitTreeState:"clean", BuildDate:"2018-06-06T08:13:03Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.4", GitCommit:"5ca598b4ba5abb89bb773071ce452e33fb66339d", GitTreeState:"clean", BuildDate:"2018-06-06T08:00:59Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"}
我无法理解我是如何解决这个问题的。 提前致谢
答案 0 :(得分:2)
错误no storage class is set
清楚地说明了问题:无法创建卷,因为该卷的声明使用的是不存在的存储类。
创建一个满足您要求的存储类,以便volumeclaim可以绑定卷。
Azure的一个示例:
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: slow
provisioner: kubernetes.io/azure-disk
parameters:
storageaccounttype: Standard_LRS
kind: Shared
有关此内容的更多信息:https://kubernetes.io/docs/concepts/storage/storage-classes/
虽然如第一行所述,你应该熟悉
https://kubernetes.io/docs/concepts/storage/volumes/
和
https://kubernetes.io/docs/concepts/storage/persistent-volumes/
第一
答案 1 :(得分:0)
...也许这可以帮助您:
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: fast
provisioner: kubernetes.io/gce-pd
parameters:
type: pd-ssd
来自链接:https://kubernetes.io/zh/docs/concepts/storage/dynamic-provisioning/
(我发现这只是运气...)