Channels
  • k

    Kevin S

    3 months ago
    👋 Working on getting the self hosted helm chart running, getting some errors 🧵
    > 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>"}

    Kinda random DNS lookup error, though nslookup is fine
    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

    init image is using
    image: "infracost/cloud-pricing-api:v0.3.5"
  • Hassan (Infracost)

    Hassan (Infracost)

    3 months ago
    Hey Kevin! Let me see if anyone is online to help 🙂
  • Vadim (Infracost)

    Vadim (Infracost)

    3 months ago
    Hey Kevin! 🙂
  • k

    Kevin S

    3 months ago
    👋
  • Vadim (Infracost)

    Vadim (Infracost)

    3 months ago
    This is interesting, let me try to run it on my machine, I haven't seen this before
    Oh, it's in the k8s, that's why 😄
    Have you tried to deploy CPAPI (cloud pricing API) locally?
  • k

    Kevin S

    3 months ago
    yeah, this is using your helm chart on EKS 1.21
    i haven't tried it locally
  • Vadim (Infracost)

    Vadim (Infracost)

    3 months ago
    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

    3 months ago
    hmmm yeah podman seems ok, maybe this is a weird edge case with EKS/Docker runtime/alpine
    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)

    3 months ago
    Oh, so it is resolved correctly here, just missing the header
  • k

    Kevin S

    3 months ago
    yeah, thats expected
  • Alistair (Infracost)

    Alistair (Infracost)

    3 months ago
    Could it be an ipv6 issue? Does
    curl -L -4 <https://pricing.api.infracost.io>
    work?
  • k

    Kevin S

    3 months ago
    Hmm, nope
    from the pod -
  • Alistair (Infracost)

    Alistair (Infracost)

    3 months ago
    Hmm, I’m trying it in our own EKS cluster and can’t reproduce
  • k

    Kevin S

    3 months ago
    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)

    3 months ago
    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$

    Do you have a HTTP proxy configured?
  • k

    Kevin S

    3 months ago
    Nope, this namespace should be able to reach out to the world
  • Alistair (Infracost)

    Alistair (Infracost)

    3 months ago
    so does
    curl -L <https://infracost.io>
    work?
  • k

    Kevin S

    3 months ago
    hmm, that fails as well. looks like its curl resolution in general
    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>

    but only from the alpine pods, I've got some internal apps on ubuntu images that are good
  • Alistair (Infracost)

    Alistair (Infracost)

    3 months ago
    Weird, just trying something quickly…
  • k

    Kevin S

    3 months ago
    i think i found it
  • Alistair (Infracost)

    Alistair (Infracost)

    3 months ago
    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
  • k

    Kevin S

    3 months ago
    https://stackoverflow.com/questions/65181012/does-alpine-have-known-dns-issue-within-kubernetes/65593511#65593511
    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
    adding a
    dnsConfig
    section to job-init seems to do the trick
    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"

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

    3 months ago
    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

    3 months ago
    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)

    3 months ago
    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.
    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

    3 months ago
    Apart from this bug, everything seemed pretty intuitive and documentation was good for the helm setup, so in general 👍 👍 👍
    we like to keep atlantis fairly locked down so the self hosted option works pretty well for our case.
  • Alistair (Infracost)

    Alistair (Infracost)

    3 months ago
    🙌 awesome!