I'm trying to store acme file in a persistent volume on kubernetes. I'm following this tutorial : https://blog.nobugware.com/post/2019/advanced-traefik-2-0-with-kubernetes/
I have a persistent volume claim (pvc) named traefik-acme-storage
.
acme-storage.yaml
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
labels:
app: traefik
name: traefik-acme-storage
namespace: traefik
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: "100Mi"
I have also a daemonset which expose traefik and mount a volume named storage-volume
linked with my persistent volume claim.
traefik.yaml
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
namespace: traefik
name: traefik-ingress-controller
labels:
k8s-app: traefik-ingress
app: traefik
spec:
selector:
matchLabels:
k8s-app: traefik-ingress-lb
name: traefik-ingress-lb
template:
metadata:
labels:
k8s-app: traefik-ingress-lb
name: traefik-ingress-lb
spec:
terminationGracePeriodSeconds: 60
dnsPolicy: ClusterFirstWithHostNet
hostNetwork: true
serviceAccountName: traefik-ingress-controller
containers:
- name: traefik-ingress-lb
image: traefik:v2.1.4
args:
- --log.level=INFO
- --entrypoints.web.Address=:80
- --entrypoints.websecure.Address=:443
- --providers.kubernetescrd
- --certificatesresolvers.default.acme.storage=/data/acme.json
ports:
- name: http
containerPort: 80
- name: https
containerPort: 443
- name: admin
containerPort: 8080
volumeMounts:
- name: storage-volume
mountPath: /data
volumes:
- name: storage-volume
persistentVolumeClaim:
claimName: traefik-acme-storage
When I apply these two files the pod created by the daemonset and the persistent volume claims are both in pending state.
The error I have in the pod :
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Warning FailedScheduling <unknown> default-scheduler error while running "VolumeBinding" filter plugin for pod "traefik-ingress-controller-9xgns": pod has unbound immediate PersistentVolumeClaims
The error I have in the persistent volume claim :
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal FailedBinding 11s (x4 over 49s) persistentvolume-controller no persistent volumes available for this claim and no storage class is set
Can someone explain to me why the pvc can't bind my volume declared in the daemonset container and how to solve this ?
Thanks by advance