我跟随this在我的主节点中安装kong-ingress-controller。但是当我部署postgres-0时,它创建了待处理的卷。我使用自己的云。这是我创建持久性卷的Yaml:
apiVersion: v1
kind: PersistentVolume
metadata:
name: postgre-pv-volume
namespace : kong
labels:
type: local
spec:
storageClassName: manual
capacity:
storage: 1Gi
accessModes:
- ReadWriteOnce
hostPath:
path: "/var/lib/postgresql/data"
当我运行kubectl describe pod postgres-0 -n kong
结果:
Name: postgres-0
Namespace: kong
Priority: 0
Node: <none>
Labels: app=postgres
controller-revision-hash=postgres-59ccf8fcf7
statefulset.kubernetes.io/pod-name=postgres-0
Annotations: <none>
Status: Pending
IP:
IPs: <none>
Controlled By: StatefulSet/postgres
Containers:
postgres:
Image: postgres:9.5
Port: 5432/TCP
Host Port: 0/TCP
Environment:
POSTGRES_USER: kong
POSTGRES_PASSWORD: kong
POSTGRES_DB: kong
PGDATA: /var/lib/postgresql/data/pgdata
Mounts:
/var/lib/postgresql/data from datadir (rw,path="pgdata")
/var/run/secrets/kubernetes.io/serviceaccount from default-token-g7828 (ro)
Conditions:
Type Status
PodScheduled False
Volumes:
datadir:
Type: PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
ClaimName: datadir-postgres-0
ReadOnly: false
default-token-g7828:
Type: Secret (a volume populated by a Secret)
SecretName: default-token-g7828
Optional: false
QoS Class: BestEffort
Node-Selectors: <none>
Tolerations: node.kubernetes.io/not-ready:NoExecute for 300s
node.kubernetes.io/unreachable:NoExecute for 300s
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Warning FailedScheduling <unknown> default-scheduler pod has unbound immediate PersistentVolumeClaims
Warning FailedScheduling <unknown> default-scheduler pod has unbound immediate PersistentVolumeClaims
请帮助我。谢谢
答案 0 :(得分:0)
问题可能在于StorageClass的配置错误或没有配置。
1。。首先,必须确保您具有称为“ manual”的存储类。
$ kubectl get storageclass
StorageClass对象的名称很重要,它是用户可以请求特定类的方式。
2。。要创建StorageClass,您必须定义配置文件,例如:
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: manual
provisioner: xxx
reclaimPolicy: Retain
allowVolumeExpansion: true
mountOptions:
- debug
volumeBindingMode: Immediate
存储类具有provisioner,用于确定用于配置PV的卷插件。必须指定此字段(xxx)。
请注意以下定义:
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: local-storage
provisioner: kubernetes.io/no-provisioner
volumeBindingMode: WaitForFirstConsumer
Local volumes当前不支持动态配置,但是仍应创建一个StorageClass来延迟卷绑定,直到pod调度为止。由WaitForFirstConsumer卷绑定模式指定。
延迟卷绑定使调度程序在为PersistentVolumeClaim选择合适的PersistentVolume时,可以考虑pod的所有调度约束。
让我知道是否有帮助。