MoJo2600 / pihole-kubernetes

PiHole on kubernetes
498 stars 173 forks source link

CNAME entries - error: read-only file system #224

Closed krisclarkdev closed 2 years ago

krisclarkdev commented 2 years ago

When adding a CNAME entry using the following values.yaml the web ui reports it has been successful but nothing populates. When checking the pod logs I get the following error

/opt/pihole/webpage.sh: line 769: /etc/dnsmasq.d/05-pihole-custom-cname.conf: Read-only file system

values.yaml

replicaCount: 2
strategyType: RollingUpdate
maxSurge: 1
maxUnavailable: 1

image:
  repository: "pihole/pihole"
  tag: ""
  pullPolicy: IfNotPresent

dualStack:
  enabled: false

dnsHostPort:
  enabled: false
  port: 53

serviceDns:
  loadBalancerIP: 192.168.6.60
  mixedService: false
  type: LoadBalancer
  port: 53
  externalTrafficPolicy: Local
  annotations:
    metallb.universe.tf/allow-shared-ip: pihole-svc

serviceDhcp:
  enabled: false

serviceWeb:
  loadBalancerIP: 192.168.6.60
  http:
    enabled: true
    port: 80

  https:
    enabled: true
    port: 443

  type: LoadBalancer
  externalTrafficPolicy: Local
  loadBalancerIP: ""
  loadBalancerIPv6: ""

  annotations:
    metallb.universe.tf/allow-shared-ip: pihole-svc

virtualHost: pihole

ingress:
  enabled: false
  annotations: {}
  path: /
  hosts:
    - chart-example.local
  tls: []

probes:
  liveness:
    enabled: true
    initialDelaySeconds: 60
    failureThreshold: 10
    timeoutSeconds: 5
  readiness:
    enabled: true
    initialDelaySeconds: 60
    failureThreshold: 3
    timeoutSeconds: 5

resources: {}

persistentVolumeClaim:
  enabled: true
  existingClaim: "pihole-claim"
  accessModes:
    - ReadWriteMany
  size: "50Gi"

nodeSelector: {}
tolerations: []
topologySpreadConstraints: []

affinity:
  nodeAffinity:
    requiredDuringSchedulingIgnoredDuringExecution:
      nodeSelectorTerms:
      - matchExpressions:
        - key: kubernetes.io/hostname
          operator: NotIn
          values:
          - k3s-primary

adminPassword: "password"

admin:
  existingSecret: "pihole"
  passwordKey: "password"

extraEnvVars: {}
  # TZ: UTC

extraEnvVarsSecret: {}

DNS1: "1.1.1.1"
DNS2: "1.0.0.1"

antiaff: {}

doh: {}

dnsmasq:
  upstreamServers: []
  customDnsEntries: []
  additionalHostsEntries: []
  staticDhcpEntries: []
  customSettings:
  customCnameEntries: []

adlists: {}
  # If you want to provide blocklists, add them here.
  # - https://hosts-file.net/grm.txt
  # - https://reddestdream.github.io/Projects/MinimalHosts/etc/MinimalHostsBlocker/minimalhosts

whitelist: {}
blacklist: {}
regex: {}
ftl: {}

webHttp: "80"
webHttps: "443"
hostname: "pihole"
hostNetwork: "false"
privileged: "false"

customVolumes:
  enabled: false
  config: {}

extraVolumes: {}
extraVolumeMounts: {}
podAnnotations: {}

monitoring:
  podMonitor:
    enabled: false
  sidecar:
    enabled: false
    port: 9617
    image:
      repository: ekofr/pihole-exporter
      tag: 0.0.10
      pullPolicy: IfNotPresent
    resources:
      limits:
        memory: 128Mi

podDnsConfig:
  enabled: true
  policy: "None"
  nameservers:
  - 127.0.0.1
  - 1.1.1.1
  - 1.0.0.1
Serverfrog commented 2 years ago

Did somebody find something out about this? Im also currently trying to convert my old Raspberry PiHole into the Kubernetes one, also with Replica 2. I noticed that sometimes it will give me a "wrong Token" notice, but i think thats something different. Reason for me why it is so urgent: the SD Card of the Raspberry is dying...

MoJo2600 commented 2 years ago

The file 05-pihole-custom-cname.conf is loaded from a ConfigMap. ConfigMaps in kubernetes are readonly. If you want to write to this file you'd have to mount it from a file mount.

To add some background: There are two principles clashing and I see a lot of people struggling to understand those. On the one side, there is the way to configure everything with files and use helm to deploy and update the installation. In this case you would normally not do any changes in the pihole UI. You can save those files and recover your installation from there. The other way would be to use the pihole UI to do changes but then you are not able to configure things in files. If you go this way you have to take care about backup and recovery yourself. I for example do my settings in files and keep them in a git repository. So I'm able to recover anytime.

@Serverfrog Replica 2 is another topic. Pihole itself does not support to share one database between multiple installations (my knowledge might be outdated so please correct me if I'm wrong). So if you have 2 replica and the loadbalancer does round-robin to access the 2 replicas you will get either the one or the other installation. So if you do manual changes you will only change one of the two instances which will lead to unforeseen consequences.

I hope I could clarify some things and please correct me if I'm talking nonesene.

MoJo2600 commented 2 years ago

I will close this issue now, if there is anything else, then please reopen it.