That is my definition. What is strange is when i try to run the deployment it says the system is readonly but there is a file created in the correct location. So maybe, i have a mapping incorrect?
hmmm that formatting didn’t stick (side note, is there a better way to show my configs so that the formatting stays?)
My log shows
jbrunk@c1m1:~$ kubectl logs pihole-545c6844b8-qgnv4
[s6-init] making user provided files available at /var/run/s6/etc…exited 0.
[s6-init] ensuring user provided files have correct perms…exited 0.
[fix-attrs.d] applying ownership & permissions fixes…
[fix-attrs.d] 01-resolver-resolv: applying…
[fix-attrs.d] 01-resolver-resolv: exited 0.
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts…
[cont-init.d] 20-start.sh: executing…
::: Starting docker specific setup for docker diginc/pi-hole
[[ piholerules == ‘’ ]]
pihole -a -p piholerules piholerules
[✓] New password set
cp: cannot create regular file ‘/etc/dnsmasq.d/01-pihole.conf’: Read-only file system
[cont-init.d] 20-start.sh: exited 1.
[cont-finish.d] executing container finish scripts…
[cont-finish.d] done.
[s6-finish] syncing disks.
[s6-finish] sending all processes the TERM signal.
[s6-finish] sending all processes the KILL signal and exiting.
Ahhhh i may be an idiot… pihole-config is a configmap.
Is there something i need to change to allow that info to be stored in the config map? or since it’s trying to create a full file, do i need to change it so that the files get stored on the pv instead of the config map?
So you’re just trying to mount some files into the container?
If so you can load those files into a configmap like so kubectl create configmap <nameofconfigmap> --from-file <file1> --from-file <file2> . From there you can mount them directly into the path, here is a good resource, link
apiVersion: v1
kind: Pod
metadata:
name: dapi-test-pod
spec:
containers:
- name: test-container
image: k8s.gcr.io/busybox
command: [ "/bin/sh", "-c", "ls /etc/config/" ]
volumeMounts:
- name: config-volume
mountPath: /etc/config
volumes:
- name: config-volume
configMap:
# Provide the name of the ConfigMap containing the files you want
# to add to the container
name: special-config
restartPolicy: Never
You may also want to try removing the subPath arg for the config files, that might be causing the issue as it creates a folder by that name. Volumes - Kubernetes
Let me know if that makes sense or if I misread the problem.
with the config-map. The container I am using (pihole) it looks like it creates the files on the first run. So they wouldn’t exist yet.
Is the config-map not updatable? Maybe in my case modifying it to just have a standard storage vol for the configs would make more sense instead of configmap?
If you look, it says you need to pass in localhost and a backup server to insert in to resolv.conf.
dns:
- 127.0.0.1
- 1.1.1.1
But, that’s where I have run in to issues. Apparently resolv.conf is auto configured by the pod. So I was trying to enable the “dnsPolicy” so I could override it. However, when i try to deploy now.
jbrunk@c1m1:~$ kubectl create -f pihole.yaml
error: error validating "pihole.yaml": error validating data: ValidationError(Deployment.spec.template.spec.containers[0]): unknown field "dnsPolicy" in io.k8s.api.core.v1.Container; if you choose to ignore these errors, turn validation off with --validate=false
It doesn’t know what dnsPolicy is.
If i change my apiVersion from extensions/v1beta1 to v1, It doesn’t understand the kind of “deployment”
jbrunk@c1m1:~$ kubectl create -f pihole.yaml
error: unable to recognize "pihole.yaml": no matches for kind "Deployment" in version "v1"