Title
#general
k

Kevin S

03/28/2022, 8:58 PM
👋 Working on getting the self hosted helm chart running, getting some errors 🧵
8:58 PM
> cloud-pricing-api@0.3.5 job:init
> npm run db:setup && npm run job:update


> cloud-pricing-api@0.3.5 db:setup
> node dist/cmd/dbSetup.js

{"level":30,"time":1648498249334,"pid":29,"hostname":"cloud-pricing-api-init-job-vxbxz","msg":"Starting: DB setup"}
{"level":30,"time":1648498249464,"pid":29,"hostname":"cloud-pricing-api-init-job-vxbxz","msg":"Completed: DB setup"}

> cloud-pricing-api@0.3.5 job:update
> npm run data:download && npm run data:load


> cloud-pricing-api@0.3.5 data:download
> node dist/cmd/dataDownload.js

{"level":30,"time":1648498253419,"pid":62,"hostname":"cloud-pricing-api-init-job-vxbxz","msg":"Starting: downloading DB data"}
{"level":50,"time":1648498253526,"pid":62,"hostname":"cloud-pricing-api-init-job-vxbxz","msg":"There was an error downloading data: getaddrinfo ENOTFOUND <http://pricing.api.infracost.io|pricing.api.infracost.io>"}
8:58 PM
Kinda random DNS lookup error, though nslookup is fine
8:59 PM
kubectl -n ********* exec -ti cloud-pricing-api-d9df447d5-dfbhw -- /bin/bash                               
bash-5.0$ 
bash-5.0$ 
bash-5.0$ 
bash-5.0$ curl -L <https://pricing.api.infracost.io>
curl: (6) Could not resolve host: <http://pricing.api.infracost.io|pricing.api.infracost.io>
bash-5.0$ nslookup <http://pricing.api.infracost.io|pricing.api.infracost.io>
Server:		172.20.0.10
Address:	172.20.0.10:53

Non-authoritative answer:
Non-authoritative answer:
Name:	<http://pricing.api.infracost.io|pricing.api.infracost.io>
Address: 3.130.210.19
Name:	<http://pricing.api.infracost.io|pricing.api.infracost.io>
Address: 18.190.97.110
Name:	<http://pricing.api.infracost.io|pricing.api.infracost.io>
Address: 3.137.75.3
9:00 PM
init image is using
image: "infracost/cloud-pricing-api:v0.3.5"
Hassan (Infracost)

Hassan (Infracost)

03/28/2022, 9:06 PM
Hey Kevin! Let me see if anyone is online to help 🙂
Vadim (Infracost)

Vadim (Infracost)

03/28/2022, 9:06 PM
Hey Kevin! 🙂
k

Kevin S

03/28/2022, 9:06 PM
👋
Vadim (Infracost)

Vadim (Infracost)

03/28/2022, 9:07 PM
This is interesting, let me try to run it on my machine, I haven't seen this before
9:07 PM
Oh, it's in the k8s, that's why 😄
9:07 PM
Have you tried to deploy CPAPI (cloud pricing API) locally?
k

Kevin S

03/28/2022, 9:08 PM
yeah, this is using your helm chart on EKS 1.21
9:08 PM
i haven't tried it locally
Vadim (Infracost)

Vadim (Infracost)

03/28/2022, 9:13 PM
I haven't used it myself, unfortunately 😞 But @Tim (Infracost) may know something about it. He's offline now, but should be back soon
k

Kevin S

03/28/2022, 9:15 PM
hmmm yeah podman seems ok, maybe this is a weird edge case with EKS/Docker runtime/alpine
9:15 PM
podman run --entrypoint "/bin/bash" -it "infracost/cloud-pricing-api:v0.3.5"                                                                                 
bash-5.0$ 
bash-5.0$ 
bash-5.0$ 
bash-5.0$  curl -L <https://pricing.api.infracost.io>
{"error":"Invalid API key"}bash-5.0$
Vadim (Infracost)

Vadim (Infracost)

03/28/2022, 9:16 PM
Oh, so it is resolved correctly here, just missing the header
k

Kevin S

03/28/2022, 9:16 PM
yeah, thats expected
Alistair (Infracost)

Alistair (Infracost)

03/28/2022, 9:17 PM
Could it be an ipv6 issue? Does
curl -L -4 <https://pricing.api.infracost.io>
work?
k

Kevin S

03/28/2022, 9:17 PM
Hmm, nope
9:18 PM
from the pod -
Alistair (Infracost)

Alistair (Infracost)

03/28/2022, 9:18 PM
Hmm, I’m trying it in our own EKS cluster and can’t reproduce
k

Kevin S

03/28/2022, 9:18 PM
bash-5.0$ curl -L -4 <https://pricing.api.infracost.io>
curl: (6) Could not resolve host: <http://pricing.api.infracost.io|pricing.api.infracost.io>
Alistair (Infracost)

Alistair (Infracost)

03/28/2022, 9:18 PM
kc exec -it cloud-pricing-api-f6478c5c7-g25rl -- /bin/bash
bash-5.0$ curl -L <https://pricing.api.infracost.io>
{"error":"Invalid API key"}bash-5.0$
9:23 PM
Do you have a HTTP proxy configured?
k

Kevin S

03/28/2022, 9:23 PM
Nope, this namespace should be able to reach out to the world
Alistair (Infracost)

Alistair (Infracost)

03/28/2022, 9:24 PM
so does
curl -L <https://infracost.io>
work?
k

Kevin S

03/28/2022, 9:25 PM
hmm, that fails as well. looks like its curl resolution in general
9:25 PM
bash-5.0$ curl -L <https://infracost.io> -v 
* Could not resolve host: <http://infracost.io|infracost.io>
* Closing connection 0
curl: (6) Could not resolve host: <http://infracost.io|infracost.io>
bash-5.0$ curl -L <https://google.com> -v 
* Could not resolve host: <http://google.com|google.com>
* Closing connection 0
curl: (6) Could not resolve host: <http://google.com|google.com>
9:26 PM
but only from the alpine pods, I've got some internal apps on ubuntu images that are good
Alistair (Infracost)

Alistair (Infracost)

03/28/2022, 9:32 PM
Weird, just trying something quickly…
k

Kevin S

03/28/2022, 9:42 PM
i think i found the problem, one sec
Alistair (Infracost)

Alistair (Infracost)

03/28/2022, 9:44 PM
ok, in the mean time I pushed a branch and image with a debian base image if that helps: https://github.com/infracost/cloud-pricing-api/blob/debian-base-image/Dockerfile DockerHub image: infracost/cloud-pricing-api:bullseye-test
9:48 PM
core dns in EKS is going to append the search domains to infracost.io lookups, eventually forwarding resolution outside the cluster, which messes with musl apparently
9:49 PM
adding a
dnsConfig
section to job-init seems to do the trick
9:49 PM
kind: Job
metadata:
  name: cloud-pricing-api-init-job
  namespace: lineartools
  labels:
    <http://helm.sh/chart|helm.sh/chart>: cloud-pricing-api-0.5.4
    <http://app.kubernetes.io/name|app.kubernetes.io/name>: cloud-pricing-api
    <http://app.kubernetes.io/instance|app.kubernetes.io/instance>: cloud-pricing-api
    <http://app.kubernetes.io/version|app.kubernetes.io/version>: "v0.3.5"
    <http://app.kubernetes.io/managed-by|app.kubernetes.io/managed-by>: Helm
spec:
  backoffLimit: 6
  template:
    metadata:
    spec:
      restartPolicy: Never
      serviceAccountName: cloud-pricing-api
      dnsConfig:
        options:
        - name: ndots
          value: "1"
9:50 PM
> cloud-pricing-api@0.3.5 job:init
> npm run db:setup && npm run job:update


> cloud-pricing-api@0.3.5 db:setup
> node dist/cmd/dbSetup.js

{"level":30,"time":1648503942422,"pid":29,"hostname":"cloud-pricing-api-init-job-kzdzc","msg":"Starting: DB setup"}
{"level":30,"time":1648503942437,"pid":29,"hostname":"cloud-pricing-api-init-job-kzdzc","msg":"Completed: DB setup"}

> cloud-pricing-api@0.3.5 job:update
> npm run data:download && npm run data:load


> cloud-pricing-api@0.3.5 data:download
> node dist/cmd/dataDownload.js

{"level":30,"time":1648503946117,"pid":62,"hostname":"cloud-pricing-api-init-job-kzdzc","msg":"Starting: downloading DB data"}

{"level":30,"time":1648503957645,"pid":62,"hostname":"cloud-pricing-api-init-job-kzdzc","msg":"Completed: downloading DB data"}

> cloud-pricing-api@0.3.5 data:load
> node dist/cmd/dataLoad.js

{"level":30,"time":1648503959734,"pid":83,"hostname":"cloud-pricing-api-init-job-kzdzc","msg":"Starting: loading data into DB"}
{"level":30,"time":1648503959839,"pid":83,"hostname":"cloud-pricing-api-init-job-kzdzc","msg":"Loading file: ./data/products/products.csv.gz"}

{"level":30,"time":1648504143193,"pid":83,"hostname":"cloud-pricing-api-init-job-kzdzc","msg":"Completed: loading data into DB"}
Alistair (Infracost)

Alistair (Infracost)

03/28/2022, 9:50 PM
okay that’s interesting thanks for finding, this has me thinking if we should drop the alpine image in favour of a debian-based image.
k

Kevin S

03/28/2022, 9:52 PM
Yeah - we went with ubuntu across the board for our apps, the cloud images are pretty small and you get the benefit of the standard C libs 🤷
Alistair (Infracost)

Alistair (Infracost)

03/28/2022, 10:04 PM
I’ve added https://github.com/infracost/helm-charts/issues/18 to track this if you want to watch it for updates. If you get a chance to test the Debian-based image that would be great. I’ll run some tests with our setup as well.
10:14 PM
Also, would be great to get any feedback you have about the self-hosted setup so we can keep improving it 🙏. One thing that might be useful is the
/stats
page once you set it up. You can see how many cost estimates have been run and when the prices were last updated.
k

Kevin S

03/28/2022, 10:21 PM
Apart from this bug, everything seemed pretty intuitive and documentation was good for the helm setup, so in general 👍 👍 👍
10:21 PM
we like to keep atlantis fairly locked down so the self hosted infracost option works pretty well for our case.
Alistair (Infracost)

Alistair (Infracost)

03/28/2022, 10:38 PM
🙌 awesome!