我试图创建和安装一个卷,但被卡住了。
此部分创建存储:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: pvclaim2
spec:
accessModes:
- ReadWriteOnce
storageClassName: managed-premium
resources:
requests:
storage: 5Gi以下是我的部署部分的延续:
volumeMounts:
- name: config
mountPath: /config
readOnly: true
args:
- --configfile=/config/traefik.toml
volumes:
- name: config
persistentVolumeClaim:
claimName: pvclaim2
configMap:
name: traefik-config我一直收到以下错误消息:
部署“traefik-ingress控制器”无效: spec.template.spec.containers.volumeMounts.name:未找到:"config“
任何帮助都是非常感谢的。
更新:
Output from describe pv:
Conditions:
Type Status
PodScheduled False
Volumes:
certs:
Type: PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
ClaimName: pvclaim101
ReadOnly: false
config:
Type: ConfigMap (a volume populated by a ConfigMap)
Name: traefik-conf
Optional: false
traefik-ingress-controller-token-6npxp:
Type: Secret (a volume populated by a Secret)
SecretName: traefik-ingress-controller-token-6npxp
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 1m (x25 over 2m) default-scheduler persistentvolumeclaim "pvclaim101" not found发布于 2018-12-20 21:56:09
看起来你有一个缩进,它找到的是VolumeMount,而不是卷。像这样的事情应该有效:
containers:
- image: your-image
name: your-containers
volumeMounts:
- name: config
mountPath: /config
readOnly: true
args:
- --configfile=/config/traefik.toml
volumes:
- name: config
persistentVolumeClaim:
claimName: pvclaim2
configMap:
name: traefik-config发布于 2018-12-21 23:52:16
我将在这里进行一个疯狂的猜测,您的traefik入口控制器是否运行在与您的pvc相同的名称空间中?Pvc是名称空间作用域,在您的示例中,它是默认名称空间。通常,我们会将入口部署到它自己的名称空间中,比如“入口”和其他相关的豆荚。
发布于 2018-12-21 17:28:21
让我们调试一下:
1)你的PersistentVolumeClaim的名字是pvclaim2,一切看起来都很好
2) VolumeMounts部分看起来很好。config处于只读模式,对配置是正确的.
3) volumes部分描述了config卷的类型是persistentVolumeClaim,它链接到PVC pvclaim2 - ok!
4)接下来,我们可以看到,config卷的类型是configMap,而PersistentVolumeClaim位于同一个time...and上,这将是将来出现错误的原因。假设您希望使用config卷作为configfile traefik.toml的挂载,则不需要PVC (特别是在只读模式下的5G字节)。
您所需要做的就是创建configMap。命令语法:
kubectl create configmap <map-name> <data-source>就你的情况而言,可以这样做:
kubectl create configmap traefik-config --from-file=<your-local-path-to-file>/traefik.toml然后您需要更新您的部署:
containers:
- image: your-image
name: your-containers
volumeMounts:
- name: config
mountPath: /config
readOnly: true # as far as i know configmaps are read-only since 1.9.5
- name: some-persistent-storage-name
mountPath: /<some-mount-point-for-storage>..。
volumes:
- name: config
configMap:
name: traefik-config
- name: some-persistent-storage-name
persistentVolumeClaim:
claimName: pvclaim2https://stackoverflow.com/questions/53874569
复制相似问题