Helm/Pi-Hole: Difference between revisions
Jump to navigation
Jump to search
Created page with " helm repo add mojo2600 https://mojo2600.github.io/pihole-kubernetes helm repo update && helm repo list kubectl config get-contexts ==Config== {| |valign="top"| <syntaxhighlight lang="properties"> export KUBECONFIG="${HOME}/.kube/aws-kubeconfig.yaml" export KUBECONFIG="${HOME}/.kube/dev-kubeconfig.yaml" export KUBECONFIG="${HOME}/.kube/gcp-kubeconfig.yaml" export KUBECONFIG="${HOME}/.kube/config" </syntaxhighlight> |valign="top"| <syntaxhighlight lang="bash"> cat <<'..." |
No edit summary |
||
| Line 1: | Line 1: | ||
{|class='wikitable mw-collapsible' style='width:100%' | |||
!scope='col' style='text-align:left'| | |||
Helm | |||
|- | |||
|valign='top'| | |||
<syntaxhighlight style='margin:3px 0 3px 0' lang='bash'> | |||
helm repo add mojo2600 https://mojo2600.github.io/pihole-kubernetes | |||
helm repo update && helm repo list | |||
kubectl config get-contexts | |||
</syntaxhighlight> | |||
|} | |||
== | ==Helm » Context== | ||
{| | {|class='wikitable mw-collapsible' style='width:100%' | ||
|valign= | !scope='col' style='text-align:left' colspan='2'| | ||
<syntaxhighlight lang= | Helm » Context | ||
|- | |||
|valign='top' style='width:50%'| | |||
<syntaxhighlight style='margin:3px 0 3px 0' lang='bash'> | |||
export KUBECONFIG="${HOME}/.kube/aws-kubeconfig.yaml" | export KUBECONFIG="${HOME}/.kube/aws-kubeconfig.yaml" | ||
export KUBECONFIG="${HOME}/.kube/dev-kubeconfig.yaml" | export KUBECONFIG="${HOME}/.kube/dev-kubeconfig.yaml" | ||
| Line 13: | Line 24: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
|valign= | |valign='top' style='width:50%'| | ||
<syntaxhighlight lang= | <syntaxhighlight style='margin:3px 0 3px 0' lang='bash'> | ||
cat <<'EXE'| sudo bash | cat <<'EXE'| sudo bash | ||
mkdir -p /var/minikube/pvc/pihole/data-pihole-0/ | mkdir -p /var/minikube/pvc/pihole/data-pihole-0/ | ||
| Line 22: | Line 33: | ||
|} | |} | ||
==Install== | ==Helm » Install== | ||
{| | {|class='wikitable mw-collapsible mw-collapsed' style='width:100%' | ||
|colspan= | !scope='col' style='text-align:left' colspan='2'| | ||
Helm » Install | |||
|- | |||
|colspan='2'| | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
helm show values mojo2600/pihole --version=2.31.0|less | helm show values mojo2600/pihole --version=2.31.0|less | ||
| Line 31: | Line 45: | ||
|- | |- | ||
|valign='top' style='width:50%'| | |||
<syntaxhighlight style='margin:3px 0 3px 0' lang='bash'> | |||
|valign= | |||
<syntaxhighlight lang= | |||
kubectl get ns|grep pihole | kubectl get ns|grep pihole | ||
kubectl delete ns pihole | kubectl delete ns pihole | ||
| Line 43: | Line 54: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
|valign= | |valign='top' style='width:50%'| | ||
<syntaxhighlight lang= | <syntaxhighlight style='margin:3px 0 3px 0' lang='bash'> | ||
cat <<ENV | \ | cat <<ENV | \ | ||
kubectl -n=pihole create secret generic pihole --from-env-file=/dev/stdin | kubectl -n=pihole create secret generic pihole --from-env-file=/dev/stdin | ||
| Line 51: | Line 62: | ||
ENV | ENV | ||
</syntaxhighlight> | </syntaxhighlight> | ||
|- | |- | ||
|colspan= | |colspan='2'| | ||
* [[K8s/Storage#Storage » Mount|Skipped » Find More 👉 Storage » Mount]] | * [[K8s/Storage#Storage » Mount|Skipped » Find More 👉 Storage » Mount]] | ||
---- | ---- | ||
* [[K8s/Storage#Storage » Class » Hostpath|Skipped » Find More 👉 Storage » Class » Hostpath]] | * [[K8s/Storage#Storage » Class » Hostpath|Skipped » Find More 👉 Storage » Class » Hostpath]] | ||
---- | ---- | ||
* [[K8s/Storage#Storage » Persistent Volume|Skipped » Find More 👉 Storage » Persistent Volume]] | * [[K8s/Storage#Storage » Persistent Volume|Skipped » Find More 👉 Storage » Persistent Volume]] | ||
|- | |- | ||
|valign='top'| | |||
<syntaxhighlight style='margin:3px 0 3px 0' lang='yaml' highlight='13-15'> | |||
|valign= | |||
<syntaxhighlight lang= | |||
cat <<'YML'| \ | cat <<'YML'| \ | ||
kubectl apply -f - | kubectl apply -f - | ||
| Line 98: | Line 93: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
|valign= | |valign='top'| | ||
<syntaxhighlight lang= | <syntaxhighlight style='margin:3px 0 3px 0' lang='yaml' highlight='8,9,16,17'> | ||
cat << YML | \ | cat << YML | \ | ||
kubectl apply -f - | kubectl apply -f - | ||
| Line 120: | Line 115: | ||
YML | YML | ||
</syntaxhighlight> | </syntaxhighlight> | ||
|- | |- | ||
|colspan= | |colspan='2'| | ||
<syntaxhighlight lang= | <syntaxhighlight style='margin:3px 0 3px 0' lang='yaml'> | ||
cat <<'YML' | \ | cat <<'YML' | \ | ||
helm -n=pihole upgrade -i pihole mojo2600/pihole --version=2.34.0 -f - | helm -n=pihole upgrade -i pihole mojo2600/pihole --version=2.34.0 -f - | ||
| Line 184: | Line 175: | ||
YML | YML | ||
</syntaxhighlight> | </syntaxhighlight> | ||
|- | |- | ||
|colspan= | |valign='top' colspan='2'| | ||
* [[Minikube MetalLB#MetalLB » Forward » Route|Skipped » Find More 👉 MetalLB » Forward » Route]] | * [[Minikube MetalLB#MetalLB » Forward » Route|Skipped » Find More 👉 MetalLB » Forward » Route]] | ||
|- | |- | ||
|valign='top'| | |valign='top'| | ||
<syntaxhighlight lang= | <syntaxhighlight style='margin:3px 0 3px 0' lang='bash'> | ||
telnet 192.168.49.110 53 | telnet 192.168.49.110 53 | ||
</syntaxhighlight> | </syntaxhighlight> | ||
|valign='top'| | |valign='top'| | ||
<syntaxhighlight lang= | <syntaxhighlight style='margin:3px 0 3px 0' lang='bash'> | ||
setsid open http://192.168.49.110 >/dev/null 2>&1 & | setsid open http://192.168.49.110 >/dev/null 2>&1 & | ||
</syntaxhighlight> | </syntaxhighlight> | ||
|} | |} | ||
==Uninstall== | ==Helm » Uninstall== | ||
<syntaxhighlight lang= | {|class='wikitable mw-collapsible mw-collapsed' style='width:100%' | ||
!scope='col' style='text-align:left'| | |||
Helm » Uninstall | |||
|- | |||
|valign='top'| | |||
<syntaxhighlight style='margin:3px 0 3px 0' lang='bash'> | |||
kubectl delete ns pihole | kubectl delete ns pihole | ||
helm -n pihole status pihole | helm -n pihole status pihole | ||
| Line 217: | Line 205: | ||
kubectl delete pv pihole-data-pihole-0 | kubectl delete pv pihole-data-pihole-0 | ||
</syntaxhighlight> | </syntaxhighlight> | ||
|} | |||
==Playground== | ==Playground== | ||
{| | {|class='wikitable mw-collapsible mw-collapsed' style='width:100%' | ||
| colspan= | !scope='col' style='text-align:left' colspan='2'| | ||
<syntaxhighlight lang= | Playground | ||
|- | |||
|valign='top' colspan='2'| | |||
<syntaxhighlight style='margin:3px 0 3px 0' lang='bash'> | |||
helm -n pihole install pihole mojo2600/pihole --version=2.33.0 | helm -n pihole install pihole mojo2600/pihole --version=2.33.0 | ||
helm -n pihole upgrade -i pihole mojo2600/pihole --version=2.34.0 | helm -n pihole upgrade -i pihole mojo2600/pihole --version=2.34.0 | ||
helm show values mojo2600/pihole --version=2.34.0|less | helm show values mojo2600/pihole --version=2.34.0|less | ||
</syntaxhighlight> | </syntaxhighlight> | ||
|- | |- | ||
| colspan= | |valign='top' colspan='2'| | ||
<syntaxhighlight lang= | <syntaxhighlight style='margin:3px 0 3px 0' lang='bash'> | ||
kubectl -n pihole get secret pihole -o json|jq -r '.data.password'|base64 -d;echo | kubectl -n pihole get secret pihole -o json|jq -r '.data.password'|base64 -d;echo | ||
| Line 239: | Line 227: | ||
kubectl -n pihole logs -f svc/pihole-web | kubectl -n pihole logs -f svc/pihole-web | ||
</syntaxhighlight> | </syntaxhighlight> | ||
|- | |- | ||
| colspan= | |valign='top' colspan='2'| | ||
<syntaxhighlight lang= | <syntaxhighlight style='margin:3px 0 3px 0' lang='bash'> | ||
kubectl config --kubeconfig=${HOME}/.kube/aws-kubeconfig.yaml view --flatten | kubectl config --kubeconfig=${HOME}/.kube/aws-kubeconfig.yaml view --flatten | ||
kubectl config --kubeconfig=${HOME}/.kube/dev-kubeconfig.yaml view --flatten | kubectl config --kubeconfig=${HOME}/.kube/dev-kubeconfig.yaml view --flatten | ||
| Line 251: | Line 235: | ||
kubectl config --kubeconfig=${HOME}/.kube/config view --flatten | kubectl config --kubeconfig=${HOME}/.kube/config view --flatten | ||
</syntaxhighlight> | </syntaxhighlight> | ||
|- | |- | ||
| valign= | |valign='top' style='width:50%'| | ||
<syntaxhighlight lang= | <syntaxhighlight style='margin:3px 0 3px 0' lang='bash'> | ||
kubectl -n pihole delete all --all | kubectl -n pihole delete all --all | ||
kubectl -n pihole delete ing --all | kubectl -n pihole delete ing --all | ||
| Line 263: | Line 243: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| valign= | |valign='top' style='width:50%'| | ||
<syntaxhighlight lang= | <syntaxhighlight style='margin:3px 0 3px 0' lang='bash'> | ||
kubectl delete pv pihole-data-pihole-0 | kubectl delete pv pihole-data-pihole-0 | ||
kubectl -n pihole delete svc --all | kubectl -n pihole delete svc --all | ||
| Line 271: | Line 251: | ||
|- | |- | ||
|valign='top' style='width:50%'| | |||
<syntaxhighlight style='margin:3px 0 3px 0' lang='bash'> | |||
| valign= | |||
<syntaxhighlight lang= | |||
kubectl -n pihole rollout history deploy pihole | kubectl -n pihole rollout history deploy pihole | ||
kubectl -n pihole rollout restart deploy pihole | kubectl -n pihole rollout restart deploy pihole | ||
| Line 281: | Line 258: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| valign= | |valign='top' style='width:50%'| | ||
<syntaxhighlight style='margin:3px 0 3px 0' lang='bash'> | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
kubectl -n pihole exec -it svc/pihole-web -c pihole -- ash | kubectl -n pihole exec -it svc/pihole-web -c pihole -- ash | ||
| Line 287: | Line 265: | ||
kubectl -n pihole logs -f svc/pihole-web | kubectl -n pihole logs -f svc/pihole-web | ||
</syntaxhighlight> | </syntaxhighlight> | ||
|} | |} | ||
==References== | ==References== | ||
{| | {|class='wikitable mw-collapsible' style='width:100%' | ||
| valign= | !scope='col' style='text-align:left' colspan='3'| | ||
References | |||
|- | |||
|valign='top' style='width:34%'| | |||
* [[Helm/Prometheus Stack|Helm » Prometheus Stack]] | * [[Helm/Prometheus Stack|Helm » Prometheus Stack]] | ||
* [[Helm/Cert Manager|Helm » Cert Manager]] | * [[Helm/Cert Manager|Helm » Cert Manager]] | ||
| Line 299: | Line 279: | ||
* [[Helm]] | * [[Helm]] | ||
| valign= | |valign='top' style='width:33%'| | ||
* [https://stackoverflow.com/questions/75596795/ Helm » Pass YAML/JSON using <code>stdin</code>] | * [https://stackoverflow.com/questions/75596795/ Helm » Pass YAML/JSON using <code>stdin</code>] | ||
| valign= | |valign='top' style='width:33%'| | ||
|- | |- | ||
|valign='top'| | |||
| valign= | |||
* [https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/ K8s » Configure Service Accounts for Pods] | * [https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/ K8s » Configure Service Accounts for Pods] | ||
* [https://spacelift.io/blog/restart-kubernetes-pods-with-kubectl K8s » Restart Pods With Kubectl] | * [https://spacelift.io/blog/restart-kubernetes-pods-with-kubectl K8s » Restart Pods With Kubectl] | ||
| Line 320: | Line 296: | ||
* [[K8s]] | * [[K8s]] | ||
| valign= | |valign='top'| | ||
* [https://kubernetes.io/docs/reference/kubectl/generated/kubectl_rollout/ K8s » <code>kubectl rollout</code>] | * [https://kubernetes.io/docs/reference/kubectl/generated/kubectl_rollout/ K8s » <code>kubectl rollout</code>] | ||
* [[K8s/CSI Hostpath Driver|K8s » CSI Hostpath Driver]] | * [[K8s/CSI Hostpath Driver|K8s » CSI Hostpath Driver]] | ||
| Line 332: | Line 308: | ||
* [[UFW]] | * [[UFW]] | ||
| valign= | |valign='top'| | ||
|} | |} | ||
Revision as of 00:07, 20 October 2025
|
Helm |
|---|
helm repo add mojo2600 https://mojo2600.github.io/pihole-kubernetes
helm repo update && helm repo list
kubectl config get-contexts
|
Helm » Context
|
Helm » Context | |
|---|---|
export KUBECONFIG="${HOME}/.kube/aws-kubeconfig.yaml"
export KUBECONFIG="${HOME}/.kube/dev-kubeconfig.yaml"
export KUBECONFIG="${HOME}/.kube/gcp-kubeconfig.yaml"
export KUBECONFIG="${HOME}/.kube/config"
|
cat <<'EXE'| sudo bash
mkdir -p /var/minikube/pvc/pihole/data-pihole-0/
chown -R 0:0 /var/minikube/pvc/pihole/
EXE
|
Helm » Install
|
Helm » Install | |
|---|---|
helm show values mojo2600/pihole --version=2.31.0|less
helm show values mojo2600/pihole --version=2.34.0|less
| |
kubectl get ns|grep pihole
kubectl delete ns pihole
kubectl get ns|grep pihole
kubectl create ns pihole
|
cat <<ENV | \
kubectl -n=pihole create secret generic pihole --from-env-file=/dev/stdin
password=1EY3QexQoNg3nKMS
ENV
|
|
| |
cat <<'YML'| \
kubectl apply -f -
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: pihole-data-pihole-0
spec:
capacity:
storage: 1Gi
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain
storageClassName: hostpath
hostPath:
path: /var/hostpath_pv/pihole/data-pihole-0
type: DirectoryOrCreate
YML
|
cat << YML | \
kubectl apply -f -
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
labels:
app.kubernetes.io/name: pihole
name: data-pihole-0
namespace: pihole
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
storageClassName: hostpath
volumeName: pihole-data-pihole-0
YML
|
cat <<'YML' | \
helm -n=pihole upgrade -i pihole mojo2600/pihole --version=2.34.0 -f -
---
serviceWeb:
type: LoadBalancer
loadBalancerIP: 192.168.49.110
annotations:
metallb.universe.tf/allow-shared-ip: pihole-svc
metallb.io/ip-allocated-from-pool: metallb-ip-pool
serviceDns:
type: LoadBalancer
loadBalancerIP: 192.168.49.110
annotations:
metallb.universe.tf/allow-shared-ip: pihole-svc
metallb.io/ip-allocated-from-pool: metallb-ip-pool
DNS1: 1.1.1.1
DNS2: 8.8.8.8
admin:
enabled: true
existingSecret: pihole
passwordKey: password
persistentVolumeClaim:
enabled: true
size: 1Gi
accessModes:
- ReadWriteOnce
storageClass: hostpath
existingClaim: data-pihole-0
resources:
requests:
cpu: 100m
memory: 256Mi
limits:
cpu: 500m
memory: 512Mi
extraEnvVars:
TZ: UTC-8
virtualHost: pihole.k8s.ops
ingress:
enabled: true
ingressClassName: nginx
annotations:
kubernetes.io/tls-acme: "false"
kubernetes.io/ingress.class: nginx
pathType: ImplementationSpecific
path: /
hosts:
- pihole.k8s.ops
YML
| |
telnet 192.168.49.110 53
|
setsid open http://192.168.49.110 >/dev/null 2>&1 &
|
Helm » Uninstall
|
Helm » Uninstall |
|---|
kubectl delete ns pihole
helm -n pihole status pihole
helm -n pihole get all pihole
helm -n pihole uninstall pihole
kubectl -n pihole delete pvc --all
kubectl delete pv pihole-data-pihole-0
|
Playground
|
Playground | |
|---|---|
helm -n pihole install pihole mojo2600/pihole --version=2.33.0
helm -n pihole upgrade -i pihole mojo2600/pihole --version=2.34.0
helm show values mojo2600/pihole --version=2.34.0|less
| |
kubectl -n pihole get secret pihole -o json|jq -r '.data.password'|base64 -d;echo
kubectl -n pihole exec -it svc/pihole-web -c pihole -- ash
kubectl -n pihole logs -f svc/pihole-web -c pihole
kubectl -n pihole logs -f svc/pihole-web
| |
kubectl config --kubeconfig=${HOME}/.kube/aws-kubeconfig.yaml view --flatten
kubectl config --kubeconfig=${HOME}/.kube/dev-kubeconfig.yaml view --flatten
kubectl config --kubeconfig=${HOME}/.kube/gcp-kubeconfig.yaml view --flatten
kubectl config --kubeconfig=${HOME}/.kube/config view --flatten
| |
kubectl -n pihole delete all --all
kubectl -n pihole delete ing --all
kubectl -n pihole delete sts --all
|
kubectl delete pv pihole-data-pihole-0
kubectl -n pihole delete svc --all
kubectl -n pihole delete pvc --all
|
kubectl -n pihole rollout history deploy pihole
kubectl -n pihole rollout restart deploy pihole
kubectl -n pihole rollout status deploy pihole
|
<syntaxhighlight lang="bash">
kubectl -n pihole exec -it svc/pihole-web -c pihole -- ash
kubectl -n pihole logs -f svc/pihole-web -c pihole
kubectl -n pihole logs -f svc/pihole-web
|
References
|
References | ||
|---|---|---|