Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't start it when deploying to K8s #202

Open
monotok opened this issue Sep 24, 2023 · 1 comment
Open

Can't start it when deploying to K8s #202

monotok opened this issue Sep 24, 2023 · 1 comment

Comments

@monotok
Copy link

monotok commented Sep 24, 2023

Hi,
I am trying to deploy this into my K8s cluster (RKE2) and I can't get the container to run without crashing. I have used my own deployment file and the linked Helm with the same error. I can run the software locally on my Linux machine and within docker. The error does not change, no matter what environment variables I set or not.

Steps for Reproduction

  1. The deployment file in K8s. I have not included the secret.
    I tried with the prebuilt image and my own that I built from the project.
apiVersion: apps/v1
kind: Deployment
metadata:
  name: pihole-exporter
  labels:
    app: pihole-exporter
spec:
  replicas: 1
  selector:
    matchLabels:
      app: pihole-exporter
  template:
    metadata:
      name: pihole-exporter
      labels:
        app: pihole-exporter
    spec:
      containers:
        - name: pihole-exporter
#          env:
#            - name: PORT
#              value: "9617"
#            - name: PIHOLE_API_TOKEN
#              valueFrom:
#                secretKeyRef:
#                  key: piholeapi
#                  name: pihole-exporter-secrets
#            - name: PIHOLE_PROTOCOL
#              value: "http"
#            - name: PIHOLE_HOSTNAME
#              value: pihole-exporter.default.svc
          image: ekofr/pihole-exporter:v0.4.0
          imagePullPolicy: IfNotPresent
          ports:
            - containerPort: 9617
      restartPolicy: Always
      

Expected behavior:
INFO[0000] ------------------------------------
2023-09-24T21:43:31.824404025Z INFO[0000] - Pi-hole exporter configuration -
2023-09-24T21:43:31.824409238Z INFO[0000] ------------------------------------
2023-09-24T21:43:31.824413221Z INFO[0000] Go version: go1.21.1
2023-09-24T21:43:31.824416889Z INFO[0000] PIHoleProtocol : [http]
2023-09-24T21:43:31.824420491Z INFO[0000] PIHoleHostname : [127.0.0.1]
2023-09-24T21:43:31.824424262Z INFO[0000] PIHolePort : [80]
2023-09-24T21:43:31.824427984Z INFO[0000] BindAddr : 0.0.0.0
2023-09-24T21:43:31.824431691Z INFO[0000] Port : 9617
2023-09-24T21:43:31.824435374Z INFO[0000] Timeout : 5s
2023-09-24T21:43:31.824439128Z INFO[0000] ------------------------------------
2023-09-24T21:43:31.824445972Z INFO[0000] New Prometheus metric registered: domains_blocked
2023-09-24T21:43:31.824449826Z INFO[0000] New Prometheus metric registered: dns_queries_today
2023-09-24T21:43:31.824453583Z INFO[0000] New Prometheus metric registered: ads_blocked_today
2023-09-24T21:43:31.824457258Z INFO[0000] New Prometheus metric registered: ads_percentag_today
2023-09-24T21:43:31.824460968Z INFO[0000] New Prometheus metric registered: unique_domains
2023-09-24T21:43:31.824464649Z INFO[0000] New Prometheus metric registered: queries_forwarded
2023-09-24T21:43:31.824468398Z INFO[0000] New Prometheus metric registered: queries_cached
2023-09-24T21:43:31.824472111Z INFO[0000] New Prometheus metric registered: clients_ever_seen
2023-09-24T21:43:31.824475878Z INFO[0000] New Prometheus metric registered: unique_clients
2023-09-24T21:43:31.824480281Z INFO[0000] New Prometheus metric registered: dns_queries_all_types
2023-09-24T21:43:31.824484233Z INFO[0000] New Prometheus metric registered: reply
2023-09-24T21:43:31.824488021Z INFO[0000] New Prometheus metric registered: top_queries
2023-09-24T21:43:31.824492329Z INFO[0000] New Prometheus metric registered: top_ads
2023-09-24T21:43:31.824496069Z INFO[0000] New Prometheus metric registered: top_sources
2023-09-24T21:43:31.824523629Z INFO[0000] New Prometheus metric registered: forward_destinations
2023-09-24T21:43:31.824533351Z INFO[0000] New Prometheus metric registered: querytypes
2023-09-24T21:43:31.824537171Z INFO[0000] New Prometheus metric registered: status
2023-09-24T21:43:31.824562213Z INFO[0000] Creating client with config <Config@C0000AE128 PIHoleProtocol=http, PIHoleHostname=127.0.0.1, PIHolePort=80, BindAddr=, Port=0>
2023-09-24T21:43:31.824621285Z INFO[0000] Starting HTTP server

Actual behavior:

The IP listed here is the IP of the service in front of the pihole pod. I have no idea how it finds it.

panic: strconv.ParseUint: parsing "tcp://10.43.132.163:53": invalid syntax
goroutine 1 [running]:
github.com/eko/pihole-exporter/config.Load()
 /go/src/github.com/eko/pihole-exporter/config/configuration.go:67 +0x3f2
main.main()
 /go/src/github.com/eko/pihole-exporter/main.go:14 +0x1f

Platforms:

K8s RKE2 1.25.X

Versions:

Which versions are you running?

0.4.0

@jcelaya
Copy link

jcelaya commented Nov 19, 2023

I had the same problem and the solution is to set the environment variable PIHOLE_PORT to 80. Apparently, that variable is also set by Kubernetes to the value "tcp://{pihole_cluster_ip}:80" and that results in a parse error, because the value is expected to be an integer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants