I am trying to create and mount a volume but getting stuck.
This part creates the storage:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: pvclaim2
spec:
accessModes:
- ReadWriteOnce
storageClassName: managed-premium
resources:
requests:
storage: 5Gi
The following is a continuation of my deployment section:
volumeMounts:
- name: config
mountPath: /config
readOnly: true
args:
- --configfile=/config/traefik.toml
volumes:
- name: config
persistentVolumeClaim:
claimName: pvclaim2
configMap:
name: traefik-config
I keep getting the below error message:
The Deployment "traefik-ingress-controller" is invalid: spec.template.spec.containers[0].volumeMounts[0].name: Not found: "config"
Any help is appreciated.
UPDATE:
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
Looks like you have an indentation it's finding the VolumeMount but not the Volume. Something like this should work:
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