Helm/Pi-Hole: Difference between revisions

From Chorke Wiki
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 <<'..."
 
 
(35 intermediate revisions by the same user not shown)
Line 1: Line 1:
helm repo add mojo2600 https://mojo2600.github.io/pihole-kubernetes
{|class='wikitable' style='width:100%;margin:-11px 0 6px 0'
helm repo update && helm repo list
!scope='col' style='text-align:left'|
kubectl config get-contexts
Helm
|-
|valign='top'|
<syntaxhighlight style='margin: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>
|}


==Config==
==Helm » Context==
{|
{|class='wikitable mw-collapsible' style='width:100%;margin:3px 0'
|valign="top"|
!scope='col' style='text-align:left' colspan='2'|
<syntaxhighlight lang="properties">
Helm » Context
|-
|valign='top' style='width:50%'|
<syntaxhighlight style='margin: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="top"|
|valign='top' style='width:50%'|
<syntaxhighlight lang="bash">
<syntaxhighlight style='margin: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%;margin:3px 0'
|colspan="2"|
!scope='col' style='text-align:left' colspan='2'|
<syntaxhighlight lang="bash">
Helm » Install
|-
|colspan='2'|
<syntaxhighlight style='margin:3px 0' lang='bash'>
helm show  values mojo2600/pihole --version=2.31.0|less
helm show  values mojo2600/pihole --version=2.31.0|less
helm show  values mojo2600/pihole --version=2.34.0|less
helm show  values mojo2600/pihole --version=2.34.0|less
Line 31: Line 45:


|-
|-
|colspan="2"|
|valign='top' style='width:50%'|
----
<syntaxhighlight style='margin:3px 0' lang='bash'>
|-
export KUBECONFIG="${HOME}/.kube/shahed-ab-kubeconfig.yaml"
|valign="top"|
kubectl create ns  pihole || true
<syntaxhighlight lang="bash">
kubectl get ns|grep pihole
kubectl delete ns  pihole


kubectl get ns|grep pihole
kubectl get ns|grep pihole
kubectl create ns  pihole
kubectl delete ns  pihole || true
</syntaxhighlight>
</syntaxhighlight>


|valign="bottom"|
|valign='top' style='width:50%'|
<syntaxhighlight lang="bash">
<syntaxhighlight style='margin: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="2"|
----
|-
|-
|colspan="2"|
|colspan='2'|
* [[K8s/Storage#Storage » Mount|Skipped » Find More 👉 Storage » Mount]]
* [[K8s/Storage#Storage » Mount|Skipped » Find More 👉 Storage » Mount]]
|-
|colspan="2"|
----
----
|-
|colspan="2"|
* [[K8s/Storage#Storage » Class » Hostpath|Skipped » Find More 👉 Storage » Class » Hostpath]]
* [[K8s/Storage#Storage » Class » Hostpath|Skipped » Find More 👉 Storage » Class » Hostpath]]
|-
|colspan="2"|
----
----
|-
|colspan="2"|
* [[K8s/Storage#Storage » Persistent Volume|Skipped » Find More 👉 Storage » Persistent Volume]]
* [[K8s/Storage#Storage » Persistent Volume|Skipped » Find More 👉 Storage » Persistent Volume]]
|-
|-
|colspan="2"|
|valign='top'|
----
<syntaxhighlight style='margin:3px 0' lang='yaml' highlight='13-15'>
|-
|valign="top"|
<syntaxhighlight lang="yaml" highlight="13-15">
cat <<'YML'| \
cat <<'YML'| \
kubectl apply -f -
kubectl apply -f -
Line 98: Line 93:
</syntaxhighlight>
</syntaxhighlight>


|valign="top"|
|valign='top'|
<syntaxhighlight lang="yaml" highlight="8,9,16,17">
<syntaxhighlight style='margin: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="2"|
----
|-
|-
|colspan="2"|
|colspan='2'|
<syntaxhighlight lang="yaml">
<syntaxhighlight style='margin: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 146: Line 137:
DNS1: 1.1.1.1
DNS1: 1.1.1.1
DNS2: 8.8.8.8
DNS2: 8.8.8.8
dnsmasq:
  upstreamServers: []
#  - 1.1.1.1
#  - 8.8.8.8
  customDnsEntries:
    - address=/biz.ops/192.168.49.2
    - address=/k8s.ops/192.168.49.2
    - address=/dev.shahed.biz/10.19.83.100
  additionalHostsEntries:
    - 192.168.49.109 harbor.k8s.ops
    - 192.168.49.110 pihole.k8s.ops
  customCnameEntries:
    - cname=k8s.ops,pihole.k8s.ops
    - cname=harbor.k8s.ops,pihole.k8s.ops


admin:
admin:
Line 184: Line 193:
YML
YML
</syntaxhighlight>
</syntaxhighlight>
|-
|valign='top' colspan='2'|
* [[Minikube MetalLB#MetalLB » Forward » Route|Skipped » Find More 👉 MetalLB » Forward » Route]]
|-
|valign='top'|
<syntaxhighlight style='margin:3px 0' lang='bash'>
telnet 192.168.49.110 53
</syntaxhighlight>
|valign='top'|
<syntaxhighlight style='margin:3px 0' lang='bash'>
setsid open http://192.168.49.110 >/dev/null 2>&1 &
</syntaxhighlight>
|}
==Helm » Ingress==
{|class='wikitable mw-collapsible mw-collapsed' style='width:100%;margin:3px 0'
!scope='col' style='text-align:left' colspan='2'|
Pi-Hole » Ingress
|-
|valign='top' style='width:50%'|
<syntaxhighlight style='margin:3px 0' lang='yaml'>
cat <<'YML' | \
kubectl -n pihole apply -f -
---
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
  name: pihole-cert
  namespace: pihole
spec:
  secretName: pihole-cert
  commonName: pihole.shahed.biz.ops
  dnsNames:
    - pihole.shahed.biz.ops
    - pihole.shahed.biz
    - pihole.k8s.ops
  ipAddresses:
    - 192.168.49.110
    - 127.0.0.1
  duration: 8760h
  renewBefore: 720h
  privateKey:
    size: 256
    encoding: PKCS8
    algorithm: ECDSA
    rotationPolicy: Always
  usages:
    - digital signature
    - key encipherment
    - server auth
    - client auth
  subject:
    countries: ["BD"]
    provinces: ["Dhaka"]
    postalCodes: ["1500"]
    localities: ["Munshiganj"]
    organizations: ["Shahed, Inc."]
    organizationalUnits: ["pihole.shahed.biz.ops"]
    streetAddresses: ["256 Khal East, Passport Office"]
  issuerRef:
    name: shahed-ecc-sub-ca-2025-k8s
    kind: ClusterIssuer
YML
</syntaxhighlight>
|valign='top' style='width:50%'|
'''Shahed_ECC_Root_CA_2025''' » Firefox » Settings » Certificates » View Certificates » Import
|-
|valign='top' style='width:50%'|
<syntaxhighlight style='margin:3px 0' lang='yaml'>
cat <<'YML' | \
kubectl -n pihole patch ingress/pihole --patch-file=/dev/stdin
---
metadata:
  annotations:
    cert-manager.io/cluster-issuer: shahed-ecc-sub-ca-2025-k8s
spec:
  tls:
    - hosts:
        - pihole.shahed.biz.ops
        - pihole.shahed.biz
        - pihole.k8s.ops
        - 192.168.49.110
        - 127.0.0.1
      secretName: pihole-cert
YML
</syntaxhighlight>
|valign='top' style='width:50%'|
<syntaxhighlight style='margin:3px 0' lang='yaml'>
cat <<'YML' | \
kubectl -n pihole patch ingress/pihole --patch-file=/dev/stdin
---
metadata:
  annotations:
    cert-manager.io/cluster-issuer: null
spec:
  tls: null


YML
</syntaxhighlight>
|-
|-
|colspan="2"|
|valign='top' style='width:50%'|
----
<syntaxhighlight style='margin:3px 0' lang='bash'>
sudo systemctl restart systemd-resolved
resolvectl status
</syntaxhighlight>
 
|valign='top' style='width:50%'|
<syntaxhighlight style='margin:3px 0' lang='bash'>
setsid open http://192.168.49.110 >/dev/null 2>&1 &
setsid open htts://pihole.k8s.ops >/dev/null 2>&1 &
</syntaxhighlight>
|}
 
==Helm » Config==
{|class='wikitable mw-collapsible' style='width:100%;margin:3px 0'
!scope='col' style='text-align:left' style='width:50%'|
Pi-Hole » Config
!scope='col' style='text-align:left'  style='width:50%'|
Pi-Hole » Revert
|-
|-
|colspan="2"|
|valign='top' style='width:50%'|
* [[Minikube MetalLB#MetalLB » Forward » Route|Skipped » Find More 👉 MetalLB » Forward » Route]]
<syntaxhighlight style='margin:3px 0' lang='yaml' highlight='7,11,13,16,17,25,28,31,32'>
cat <<'YML'| \
kubectl -n pihole patch configmap \
pihole-custom-dnsmasq --type merge --patch-file=/dev/stdin
---
data:
  02-custom.conf: |
    addn-hosts=/etc/addn-hosts
    address=/bd.ops/192.168.49.2
    address=/io.ops/192.168.49.2
    address=/my.ops/192.168.49.2
    address=/biz.ops/192.168.49.2
    address=/com.ops/192.168.49.2
    address=/k8s.ops/192.168.49.2
    address=/org.ops/192.168.49.2
    address=/group.ops/192.168.49.2
    address=/dev.shahed.biz/10.19.83.100
    dhcp-option=6,192.168.49.110
 
  05-pihole-custom-cname.conf: |
    cname=bd.ops,pihole.k8s.ops
    cname=io.ops,pihole.k8s.ops
    cname=my.ops,pihole.k8s.ops
    cname=biz.ops,pihole.k8s.ops
    cname=com.ops,pihole.k8s.ops
    cname=k8s.ops,pihole.k8s.ops
    cname=org.ops,pihole.k8s.ops
    cname=group.ops,pihole.k8s.ops
    cname=harbor.k8s.ops,pihole.k8s.ops
 
  addn-hosts: |
    192.168.49.109 harbor.k8s.ops
    192.168.49.110 pihole.k8s.ops
YML
</syntaxhighlight>
 
|valign='top' style='width:50%'|
<syntaxhighlight style='margin:3px 0' lang='yaml' highlight='7-11,14,15,18,19' line>
cat <<'YML'| \
kubectl -n pihole patch configmap \
pihole-custom-dnsmasq --type merge --patch-file=/dev/stdin
---
data:
  02-custom.conf: |
    addn-hosts=/etc/addn-hosts
    address=/biz.ops/192.168.49.2
    address=/k8s.ops/192.168.49.2
    address=/dev.shahed.biz/10.19.83.100
    dhcp-option=6,192.168.49.110
 
  05-pihole-custom-cname.conf: |
    cname=k8s.ops,pihole.k8s.ops
    cname=harbor.k8s.ops,pihole.k8s.ops
 
  addn-hosts: |
    192.168.49.109 harbor.k8s.ops
    192.168.49.110 pihole.k8s.ops
 
 
 
 
 
 
 
 
 
 
 
 


YML
</syntaxhighlight>
|-
|-
|colspan="2"|
|valign='top' style='width:50%'|
----
<syntaxhighlight style='margin:3px 0' lang='yaml'>
cat <<'YML' | \
kubectl -n pihole patch deploy/pihole --patch-file=/dev/stdin
---
spec:
  replicas: 0
YML
</syntaxhighlight>
 
|valign='top' style='width:50%'|
<syntaxhighlight style='margin:3px 0' lang='yaml'>
cat <<'YML' | \
kubectl -n pihole patch deploy/pihole --patch-file=/dev/stdin
---
spec:
  replicas: 1
YML
</syntaxhighlight>
|}
 
==Helm » Debug==
{|class='wikitable mw-collapsible' style='width:100%;margin:3px 0'
!scope='col' style='text-align:left'|
Helm » Debug
|-
|-
|valign='top'|
|valign='top'|
<syntaxhighlight lang="bash">
<syntaxhighlight style='margin:3px 0' lang='bash'>
telnet 192.168.49.110 53
kubectl -n pihole exec -it svc/pihole-web -c pihole -- cat /etc/dnsmasq.d/05-pihole-custom-cname.conf
kubectl -n pihole exec -it svc/pihole-web -c pihole -- cat /etc/dnsmasq.d/02-custom.conf
kubectl -n pihole exec -it svc/pihole-web -c pihole -- cat /etc/addn-hosts
 
kubectl -n pihole exec -it svc/pihole-web -c pihole -- cat /etc/pihole/hosts/custom.list
kubectl -n pihole exec -it svc/pihole-web -c pihole -- cat /etc/pihole/adlists.list
 
kubectl -n pihole exec -it svc/pihole-web -c pihole -- cat /etc/pihole/dnsmasq.conf
kubectl -n pihole exec -it svc/pihole-web -c pihole -- cat /etc/resolv.conf
kubectl -n pihole exec -it svc/pihole-web -c pihole -- cat /etc/hosts
 
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
</syntaxhighlight>
</syntaxhighlight>
|}


==Host » Resolve==
{|class='wikitable mw-collapsible' style='width:100%;margin:3px 0'
!scope='col' style='text-align:left'|
Host » Resolve
|-
|valign='top'|
{|class='wikitable mw-collapsible mw-collapsed' style='width:100%;margin:3px 0'
!scope='col' style='text-align:left'|
Resolve » Config
|-
|valign='top'|
|valign='top'|
<syntaxhighlight lang="bash">
<syntaxhighlight style='margin:3px 0' lang='bash' highlight='1,26-29,62-80,97' line>
setsid open http://192.168.49.110 >/dev/null 2>&1 &
cat << EXE | sudo tee /etc/NetworkManager/dispatcher.d/minikube-ifupdown >/dev/null
#!/bin/bash
: '
@vendor    Shahed Academia, Inc.
@web      https://cdn.shahed.biz/docs/academia
@version  2025.10.10
@since    2025.10.10
'
 
USER_TARGET="minikube"
IFACE="\${1}"
ACTION="\${2}"
 
function silent_exit(){
  exit 0
}
 
function verify_addr(){
  printf -v DNS_HOST '%s' \$(sudo -u \${USER_TARGET} minikube ip)
  if [[ "\${DNS_HOST}" =~ ^(([1-9]?[0-9]|1[0-9][0-9]|2([0-4][0-9]|5[0-5]))\.){3}([1-9]?[0-9]|1[0-9][0-9]|2([0-4][0-9]|5[0-5]))$ ]]; then
    if [[ "\${DNS_HOST}" == '127.0.0.1' ]]; then silent_exit; fi
  else silent_exit; fi
}
 
function verify_kube(){
  printf -v K8S_JSON '%s' \$(sudo -u \${USER_TARGET} minikube status -o 'json')
  printf -v K8S_REST '%s' \$(echo \${K8S_JSON} | jq -r '.APIServer')
  printf -v K8S_KUBE '%s' \$(echo \${K8S_JSON} | jq -r '.Kubelet')
  printf -v K8S_HOST '%s' \$(echo \${K8S_JSON} | jq -r '.Host')
 
  if [[ "\${K8S_HOST}" == 'Running' ]]&&
    [[ "\${K8S_KUBE}" == 'Running' ]]&&
    [[ "\${K8S_REST}" == 'Running' ]]; then verify_addr
  else silent_exit; fi
}
 
function verify_tool(){
  if [[ -x "\$(command -v jq)" ]]; then verify_kube; else silent_exit; fi
}
 
function verify_mini(){
  if [[ -x "\$(command -v minikube)" ]]; then verify_tool; else silent_exit; fi
}
 
function verify_link(){
  HOST_ETHERS="\$(ip -j link show | jq -r '.[].ifname'| paste -sd' ' -)"
  if [[ "\${HOST_ETHERS}" =~ "\${IFACE}" ]]; then verify_mini; else silent_exit; fi
}
 
function verify_mode(){
  if [[ "\${ACTION}" == 'up' ]]; then verify_link; else verify_mini; fi
}
 
function verify(){
  verify_mode
}
 
function amend_nameserver(){
  RESOLV_CONF='/etc/resolv.conf'
  if  [[ -f \${RESOLV_CONF} ]]&&[[ "\$(grep -c \${DNS_HOST} \${RESOLV_CONF})" == 0 ]];then
    cat << CON | sudo tee \${RESOLV_CONF} >/dev/null
# /etc/resolv.conf replaced by the minikube dispatcher
# /etc/NetworkManager/dispatcher.d/minikube-ifupdown
#
# Dynamic resolv.conf (using network dispatch)
# Primary  DNS: Pi-Hole    (192.168.49.110)
# Secondary DNS: Minikube    (192.168.49.2  )
# Backup    DNS: Office DNS  (10.19.83.100  )
# Loopback  DNS: hostnamectl (127.0.0.53    )
# Public    DNS fallback: Cloudflare + Google
 
nameserver 192.168.49.110
nameserver 192.168.49.2
nameserver 10.19.83.100
nameserver 127.0.0.53
nameserver 1.1.1.1
nameserver 8.8.8.8
 
search  ops local .
options edns0 trust-ad
 
CON
  else silent_exit; fi
}
 
function handle(){
  amend_nameserver
}
 
function init(){
  verify
  handle
}
 
init
EXE
sudo chmod +x /etc/NetworkManager/dispatcher.d/minikube-ifupdown
</syntaxhighlight>
|}
{|class='wikitable mw-collapsible' style='width:100%;margin:6px 0 3px 0'
!scope='col' style='text-align:left' colspan='2'|
Resolve » Debug
|-
|valign='top' style='width:50%'|
<syntaxhighlight style='margin:3px 0' lang='bash'>
sudo /etc/NetworkManager/dispatcher.d/minikube-ifupdown lo down
sudo /etc/NetworkManager/dispatcher.d/minikube-ifupdown lo up
</syntaxhighlight>
 
|valign='top' style='width:50%'|
<syntaxhighlight style='margin:3px 0' lang='bash'>
    ls -lah /etc/NetworkManager/dispatcher.d/minikube-ifupdown
sudo rm -f  /etc/NetworkManager/dispatcher.d/minikube-ifupdown
</syntaxhighlight>
|-
|valign='top' style='width:50%'|
<syntaxhighlight style='margin:3px 0' lang='bash'>
sudo systemctl  restart systemd-resolved
    resolvectl status
</syntaxhighlight>
 
|valign='top' style='width:50%'|
<syntaxhighlight style='margin:3px 0' lang='bash'>
dig +short pihole.k8s.ops
dig +short  host.k8s.ops
</syntaxhighlight>
|-
|valign='top' style='width:50%'|
<syntaxhighlight style='margin:3px 0' lang='bash'>
kubectl -n pihole run -i --tty --rm pihole-cli \
--image=alpine --restart=Never --command -- ash
 
apk --update add curl bind-tools inetutils-telnet
</syntaxhighlight>
 
|valign='top' style='width:50%'|
<syntaxhighlight style='margin:3px 0' lang='bash'>
dig +short pihole.k8s.ops
nslookup  pihole.k8s.ops
 
ping      pihole.k8s.ops
</syntaxhighlight>
|-
|valign='top' style='width:50%'|
<syntaxhighlight style='margin:3px 0' lang='bash'>
docker run --rm alpine cat /etc/resolv.conf
docker run --rm alpine cat /etc/hosts
</syntaxhighlight>
 
|valign='top' style='width:50%'|
<syntaxhighlight style='margin:3px 0' lang='bash'>
docker run --rm alpine ping www.k8s.ops
docker run --rm alpine ping google.com
</syntaxhighlight>
|}
|}
 
==Helm » Rollout==
{|class='wikitable mw-collapsible mw-collapsed' style='width:100%;margin:3px 0'
!scope='col' style='text-align:left' colspan='2'|
Pi-Hole » Rollout
|-
|valign='top' style='width:50%'|
<syntaxhighlight style='margin:3px 0' lang='bash'>
kubectl -n pihole annotate        deploy/pihole --overwrite \
kubernetes.io/change-cause="CKI-1| Initial Deployment"
</syntaxhighlight>
 
|valign='top' style='width:50%'|
<syntaxhighlight style='margin:3px 0' lang='bash'>
kubectl -n pihole rollout history deploy/pihole
kubectl -n pihole rollout pause  deploy/pihole
</syntaxhighlight>
|-
!scope='col' style='text-align:left' style='width:50%'|
Pi-Hole » Rollout
 
!scope='col' style='text-align:left' style='width:50%'|
Pi-Hole » Revert
 
|-
|valign='top' style='width:50%'|
<syntaxhighlight style='margin:3px 0' lang='yaml'>
cat <<'YML' | \
kubectl -n pihole patch deploy/pihole --patch-file=/dev/stdin
---
spec:
  template:
    spec:
      containers:
        - name: pihole
          resources:
            requests:
              cpu: 100m
              memory: 128Mi
            limits:
              cpu: 200m
              memory: 256Mi
YML
</syntaxhighlight>
 
|valign='top' style='width:50%'|
<syntaxhighlight style='margin:3px 0' lang='yaml'>
cat <<'YML' | \
kubectl -n pihole patch deploy/pihole --patch-file=/dev/stdin
---
spec:
  template:
    spec:
      containers:
        - name: pihole
          resources:
            requests:
              cpu: 100m
              memory: 256Mi
            limits:
              cpu: 500m
              memory: 512Mi
YML
</syntaxhighlight>
|-
|valign='top' style='width:50%'|
<syntaxhighlight style='margin:3px 0' lang='bash'>
kubectl -n pihole annotate        deploy/pihole --overwrite \
kubernetes.io/change-cause="CKI-2| Resources Updated"
</syntaxhighlight>
 
|valign='top' style='width:50%'|
<syntaxhighlight style='margin:3px 0' lang='bash'>
kubectl -n pihole rollout resume  deploy/pihole
kubectl -n pihole rollout history deploy/pihole
</syntaxhighlight>
|-
|valign='top' style='width:50%'|
<syntaxhighlight style='margin:3px 0' lang='bash'>
kubectl -n pihole rollout undo    deploy/pihole --to-revision=1
kubectl -n pihole rollout history deploy/pihole
</syntaxhighlight>
 
|valign='top' style='width:50%'|
<syntaxhighlight style='margin:3px 0' lang='bash'>
kubectl -n pihole annotate        deploy/pihole --overwrite \
kubernetes.io/change-cause="CKI-3| Revert Back to CKI-1"
</syntaxhighlight>
|-
|valign='top' style='width:50%'|
<syntaxhighlight style='margin:3px 0' lang='bash'>
kubectl -n pihole get deploy pihole -o yaml \
| yq -P '.spec.template.spec.containers[]|select(.name == "pihole")|.resources'
</syntaxhighlight>
 
|valign='top' style='width:50%'|
<syntaxhighlight style='margin:3px 0' lang='bash'>
kubectl -n pihole get deploy pihole \
  -o jsonpath='{.spec.template.spec.containers[?(@.name=="pihole")].resources}' | yq -P
</syntaxhighlight>
</syntaxhighlight>
|}
|}


==Uninstall==
==Helm » Uninstall==
<syntaxhighlight lang="bash">
{|class='wikitable mw-collapsible mw-collapsed' style='width:100%;margin:3px 0'
!scope='col' style='text-align:left'|
Helm » Uninstall
|-
|valign='top'|
<syntaxhighlight style='margin: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 729:
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%;margin:3px 0'
| colspan="2" |
!scope='col' style='text-align:left' colspan='2'|
<syntaxhighlight lang="bash">
Playground
|-
|valign='top' colspan='2'|
<syntaxhighlight style='margin: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="2" |
|valign='top' colspan='2'|
----
<syntaxhighlight style='margin:3px 0' lang='bash'>
|-
| colspan="2" |
<syntaxhighlight 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 751:
kubectl -n pihole logs -f  svc/pihole-web
kubectl -n pihole logs -f  svc/pihole-web
</syntaxhighlight>
</syntaxhighlight>
|-
| colspan="2" |
----
|-
|-
| colspan="2" |
|valign='top' colspan='2'|
<syntaxhighlight lang="bash">
<syntaxhighlight style='margin: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 759:
kubectl config --kubeconfig=${HOME}/.kube/config view --flatten
kubectl config --kubeconfig=${HOME}/.kube/config view --flatten
</syntaxhighlight>
</syntaxhighlight>
|-
| colspan="2" |
----
|-
|-
| valign="top" |
|valign='top' style='width:50%'|
<syntaxhighlight lang="bash">
<syntaxhighlight style='margin: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 767:
</syntaxhighlight>
</syntaxhighlight>


| valign="top" |
|valign='top' style='width:50%'|
<syntaxhighlight lang="bash">
<syntaxhighlight style='margin: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 775:


|-
|-
| colspan="2" |
|valign='top' style='width:50%'|
----
<syntaxhighlight style='margin:3px 0' lang='bash'>
|-
| valign="top" |
<syntaxhighlight lang="bash">
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 782:
</syntaxhighlight>
</syntaxhighlight>


| valign="top" |
|valign='top' style='width:50%'|
<syntaxhighlight lang="bash">
<syntaxhighlight style='margin:3px 0' lang='bash'>
kubectl -n pihole exec -it svc/pihole-web -c pihole -- ash
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 -c pihole
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%;margin:3px 0'
| valign="top" |
!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]]
* [[Minikube MetalLB|Helm » MetalLB]]
* [[Minikube MetalLB|Helm » MetalLB]]
* [[Helm/Harbor|Helm » Harbor]]
* [https://artifacthub.io/packages/helm/mojo2600/pihole Helm » Pi-hole]
* [https://artifacthub.io/packages/helm/mojo2600/pihole Helm » Pi-hole]
* [[Helm]]
* [[Helm]]


| valign="top" |
|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="top" |
|valign='top' style='width:33%'|
 
|-
|-
| colspan="3" |
|valign='top'|
----
|-
| valign="top" |
* [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 820:
* [[K8s]]
* [[K8s]]


| valign="top" |
|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 832:
* [[UFW]]
* [[UFW]]


| valign="top" |
|valign='top'|
* [[Raspberry Pi Authoritative DNS Server|Bind9 » Authoritative DNS Server]]
* [[Raspberry Pi Secondary DNS Server|Bind9 » Secondary DNS Server]]
* [[Minikube Ingress DNS| Minikube » Ingress DNS]]
* [[Minikube Systemd|Minikube » Systemd]]
* [[Minikube MetalLB|Minikube » MetalLB]]
* [[Minikube Registry|Minikube » Registry]]
* [[Minikube Tunnel|Minikube » Tunnel]]
* [[Localtunnel]]
* [[ZA Proxy]]


|}
|}

Latest revision as of 01:57, 23 December 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
export KUBECONFIG="${HOME}/.kube/shahed-ab-kubeconfig.yaml"
kubectl create ns   pihole || true

kubectl get ns|grep pihole
kubectl delete ns   pihole || true
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

dnsmasq:
  upstreamServers: []
#   - 1.1.1.1
#   - 8.8.8.8

  customDnsEntries:
    - address=/biz.ops/192.168.49.2
    - address=/k8s.ops/192.168.49.2
    - address=/dev.shahed.biz/10.19.83.100

  additionalHostsEntries:
    - 192.168.49.109 harbor.k8s.ops
    - 192.168.49.110 pihole.k8s.ops

  customCnameEntries:
    - cname=k8s.ops,pihole.k8s.ops
    - cname=harbor.k8s.ops,pihole.k8s.ops

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 » Ingress

Pi-Hole » Ingress

cat <<'YML' | \
kubectl -n pihole apply -f -
---
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
  name: pihole-cert
  namespace: pihole
spec:
  secretName: pihole-cert
  commonName: pihole.shahed.biz.ops
  dnsNames:
    - pihole.shahed.biz.ops
    - pihole.shahed.biz
    - pihole.k8s.ops
  ipAddresses:
    - 192.168.49.110
    - 127.0.0.1
  duration: 8760h
  renewBefore: 720h
  privateKey:
    size: 256
    encoding: PKCS8
    algorithm: ECDSA
    rotationPolicy: Always
  usages:
    - digital signature
    - key encipherment
    - server auth
    - client auth
  subject:
    countries: ["BD"]
    provinces: ["Dhaka"]
    postalCodes: ["1500"]
    localities: ["Munshiganj"]
    organizations: ["Shahed, Inc."]
    organizationalUnits: ["pihole.shahed.biz.ops"]
    streetAddresses: ["256 Khal East, Passport Office"]
  issuerRef:
    name: shahed-ecc-sub-ca-2025-k8s
    kind: ClusterIssuer
YML

Shahed_ECC_Root_CA_2025 » Firefox » Settings » Certificates » View Certificates » Import

cat <<'YML' | \
kubectl -n pihole patch ingress/pihole --patch-file=/dev/stdin
---
metadata:
  annotations:
    cert-manager.io/cluster-issuer: shahed-ecc-sub-ca-2025-k8s
spec:
  tls:
    - hosts:
        - pihole.shahed.biz.ops
        - pihole.shahed.biz
        - pihole.k8s.ops
        - 192.168.49.110
        - 127.0.0.1
      secretName: pihole-cert
YML
cat <<'YML' | \
kubectl -n pihole patch ingress/pihole --patch-file=/dev/stdin
---
metadata:
  annotations:
    cert-manager.io/cluster-issuer: null
spec:
  tls: null







YML
sudo systemctl restart systemd-resolved
resolvectl status
setsid open http://192.168.49.110 >/dev/null 2>&1 &
setsid open htts://pihole.k8s.ops >/dev/null 2>&1 &

Helm » Config

Pi-Hole » Config

Pi-Hole » Revert

cat <<'YML'| \
kubectl -n pihole patch configmap \
pihole-custom-dnsmasq --type merge --patch-file=/dev/stdin
---
data:
  02-custom.conf: |
    addn-hosts=/etc/addn-hosts
    address=/bd.ops/192.168.49.2
    address=/io.ops/192.168.49.2
    address=/my.ops/192.168.49.2
    address=/biz.ops/192.168.49.2
    address=/com.ops/192.168.49.2
    address=/k8s.ops/192.168.49.2
    address=/org.ops/192.168.49.2
    address=/group.ops/192.168.49.2
    address=/dev.shahed.biz/10.19.83.100
    dhcp-option=6,192.168.49.110

  05-pihole-custom-cname.conf: |
    cname=bd.ops,pihole.k8s.ops
    cname=io.ops,pihole.k8s.ops
    cname=my.ops,pihole.k8s.ops
    cname=biz.ops,pihole.k8s.ops
    cname=com.ops,pihole.k8s.ops
    cname=k8s.ops,pihole.k8s.ops
    cname=org.ops,pihole.k8s.ops
    cname=group.ops,pihole.k8s.ops
    cname=harbor.k8s.ops,pihole.k8s.ops

  addn-hosts: |
    192.168.49.109 harbor.k8s.ops
    192.168.49.110 pihole.k8s.ops
YML
cat <<'YML'| \
kubectl -n pihole patch configmap \
pihole-custom-dnsmasq --type merge --patch-file=/dev/stdin
---
data:
  02-custom.conf: |
    addn-hosts=/etc/addn-hosts
    address=/biz.ops/192.168.49.2
    address=/k8s.ops/192.168.49.2
    address=/dev.shahed.biz/10.19.83.100
    dhcp-option=6,192.168.49.110

  05-pihole-custom-cname.conf: |
    cname=k8s.ops,pihole.k8s.ops
    cname=harbor.k8s.ops,pihole.k8s.ops

  addn-hosts: |
    192.168.49.109 harbor.k8s.ops
    192.168.49.110 pihole.k8s.ops













YML
cat <<'YML' | \
kubectl -n pihole patch deploy/pihole --patch-file=/dev/stdin
---
spec:
  replicas: 0
YML
cat <<'YML' | \
kubectl -n pihole patch deploy/pihole --patch-file=/dev/stdin
---
spec:
  replicas: 1
YML

Helm » Debug

Helm » Debug

kubectl -n pihole exec -it svc/pihole-web -c pihole -- cat /etc/dnsmasq.d/05-pihole-custom-cname.conf
kubectl -n pihole exec -it svc/pihole-web -c pihole -- cat /etc/dnsmasq.d/02-custom.conf
kubectl -n pihole exec -it svc/pihole-web -c pihole -- cat /etc/addn-hosts

kubectl -n pihole exec -it svc/pihole-web -c pihole -- cat /etc/pihole/hosts/custom.list
kubectl -n pihole exec -it svc/pihole-web -c pihole -- cat /etc/pihole/adlists.list

kubectl -n pihole exec -it svc/pihole-web -c pihole -- cat /etc/pihole/dnsmasq.conf
kubectl -n pihole exec -it svc/pihole-web -c pihole -- cat /etc/resolv.conf
kubectl -n pihole exec -it svc/pihole-web -c pihole -- cat /etc/hosts

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

Host » Resolve

Host » Resolve

Resolve » Config

cat << EXE | sudo tee /etc/NetworkManager/dispatcher.d/minikube-ifupdown >/dev/null
#!/bin/bash
: '
 @vendor    Shahed Academia, Inc.
 @web       https://cdn.shahed.biz/docs/academia
 @version   2025.10.10
 @since     2025.10.10
'

USER_TARGET="minikube"
IFACE="\${1}"
ACTION="\${2}"

function silent_exit(){
  exit 0
}

function verify_addr(){
  printf -v DNS_HOST '%s' \$(sudo -u \${USER_TARGET} minikube ip)
  if [[ "\${DNS_HOST}" =~ ^(([1-9]?[0-9]|1[0-9][0-9]|2([0-4][0-9]|5[0-5]))\.){3}([1-9]?[0-9]|1[0-9][0-9]|2([0-4][0-9]|5[0-5]))$ ]]; then
    if [[ "\${DNS_HOST}" == '127.0.0.1' ]]; then silent_exit; fi
  else silent_exit; fi
}

function verify_kube(){
  printf -v K8S_JSON '%s' \$(sudo -u \${USER_TARGET} minikube status -o 'json')
  printf -v K8S_REST '%s' \$(echo \${K8S_JSON} | jq -r '.APIServer')
  printf -v K8S_KUBE '%s' \$(echo \${K8S_JSON} | jq -r '.Kubelet')
  printf -v K8S_HOST '%s' \$(echo \${K8S_JSON} | jq -r '.Host')

  if [[ "\${K8S_HOST}" == 'Running' ]]&&
     [[ "\${K8S_KUBE}" == 'Running' ]]&&
     [[ "\${K8S_REST}" == 'Running' ]]; then verify_addr
  else silent_exit; fi
}

function verify_tool(){
  if [[ -x "\$(command -v jq)" ]]; then verify_kube; else silent_exit; fi
}

function verify_mini(){
  if [[ -x "\$(command -v minikube)" ]]; then verify_tool; else silent_exit; fi
}

function verify_link(){
  HOST_ETHERS="\$(ip -j link show | jq -r '.[].ifname'| paste -sd' ' -)"
  if [[ "\${HOST_ETHERS}" =~ "\${IFACE}" ]]; then verify_mini; else silent_exit; fi
}

function verify_mode(){
  if [[ "\${ACTION}" == 'up' ]]; then verify_link; else verify_mini; fi
}

function verify(){
  verify_mode
}

function amend_nameserver(){
  RESOLV_CONF='/etc/resolv.conf'
  if  [[ -f \${RESOLV_CONF} ]]&&[[ "\$(grep -c \${DNS_HOST} \${RESOLV_CONF})" == 0 ]];then
    cat << CON | sudo tee \${RESOLV_CONF} >/dev/null
# /etc/resolv.conf replaced by the minikube dispatcher
# /etc/NetworkManager/dispatcher.d/minikube-ifupdown
#
# Dynamic resolv.conf (using network dispatch)
# Primary   DNS: Pi-Hole     (192.168.49.110)
# Secondary DNS: Minikube    (192.168.49.2  )
# Backup    DNS: Office DNS  (10.19.83.100  )
# Loopback  DNS: hostnamectl (127.0.0.53    )
# Public    DNS fallback: Cloudflare + Google

nameserver 192.168.49.110
nameserver 192.168.49.2
nameserver 10.19.83.100
nameserver 127.0.0.53
nameserver 1.1.1.1
nameserver 8.8.8.8

search  ops local .
options edns0 trust-ad

CON
  else silent_exit; fi
}

function handle(){
  amend_nameserver
}

function init(){
  verify
  handle
}

init
EXE
sudo chmod +x /etc/NetworkManager/dispatcher.d/minikube-ifupdown

Resolve » Debug

sudo /etc/NetworkManager/dispatcher.d/minikube-ifupdown lo down
sudo /etc/NetworkManager/dispatcher.d/minikube-ifupdown lo up
     ls -lah /etc/NetworkManager/dispatcher.d/minikube-ifupdown
sudo rm -f   /etc/NetworkManager/dispatcher.d/minikube-ifupdown
sudo systemctl  restart systemd-resolved
     resolvectl status
dig +short pihole.k8s.ops
dig +short   host.k8s.ops
kubectl -n pihole run -i --tty --rm pihole-cli \
 --image=alpine --restart=Never --command -- ash

apk --update add curl bind-tools inetutils-telnet
dig +short pihole.k8s.ops
nslookup   pihole.k8s.ops

ping       pihole.k8s.ops
docker run --rm alpine cat /etc/resolv.conf
docker run --rm alpine cat /etc/hosts
docker run --rm alpine ping www.k8s.ops
docker run --rm alpine ping google.com

Helm » Rollout

Pi-Hole » Rollout

kubectl -n pihole annotate        deploy/pihole --overwrite \
 kubernetes.io/change-cause="CKI-1| Initial Deployment"
kubectl -n pihole rollout history deploy/pihole
kubectl -n pihole rollout pause   deploy/pihole

Pi-Hole » Rollout

Pi-Hole » Revert

cat <<'YML' | \
kubectl -n pihole patch deploy/pihole --patch-file=/dev/stdin
---
spec:
  template:
    spec:
      containers:
        - name: pihole
          resources:
            requests:
              cpu: 100m
              memory: 128Mi
            limits:
              cpu: 200m
              memory: 256Mi
YML
cat <<'YML' | \
kubectl -n pihole patch deploy/pihole --patch-file=/dev/stdin
---
spec:
  template:
    spec:
      containers:
        - name: pihole
          resources:
            requests:
              cpu: 100m
              memory: 256Mi
            limits:
              cpu: 500m
              memory: 512Mi
YML
kubectl -n pihole annotate        deploy/pihole --overwrite \
 kubernetes.io/change-cause="CKI-2| Resources Updated"
kubectl -n pihole rollout resume  deploy/pihole
kubectl -n pihole rollout history deploy/pihole
kubectl -n pihole rollout undo    deploy/pihole --to-revision=1
kubectl -n pihole rollout history deploy/pihole
kubectl -n pihole annotate        deploy/pihole --overwrite \
 kubernetes.io/change-cause="CKI-3| Revert Back to CKI-1"
kubectl -n pihole get deploy pihole -o yaml \
 | yq -P '.spec.template.spec.containers[]|select(.name == "pihole")|.resources'
kubectl -n pihole get deploy pihole \
  -o jsonpath='{.spec.template.spec.containers[?(@.name=="pihole")].resources}' | yq -P

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
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