Title
#general
Alistair (Infracost)

Alistair (Infracost)

10/03/2022, 3:14 PM
@Gianluca Di Vincenzo did the init job complete okay? I’m guessing there’s no prices in the DB because that couldn’t complete because the
INFRACOST_API_KEY
isn’t set.
g

Gianluca Di Vincenzo

10/03/2022, 3:30 PM
Hi @Alistair (Infracost) I have set in the secret kubernetes and the same value of the SELF_HOSTED_INFRACOST_API_KEY and restarted the pod, so that then they have the same value when entering the pod and I get the same problem.
Alistair (Infracost)

Alistair (Infracost)

10/03/2022, 3:40 PM
@Gianluca Di Vincenzo the
INFRACOST_API_KEY
needs to be a valid Infracost API key so it can pull the price DB from our APIs. There’s some steps here for generating one.
g

Gianluca Di Vincenzo

10/03/2022, 4:05 PM
Thanks for the tip I keep trying, in this case I get
Please check your …credentials.yml file or INFRACOST_API_KEY environment variable.
If you recently regenerated your API key, you can retrieve it from <https://dashboard.infracost.io>.
See <https://infracost.io/support> if you continue having issues.
Alistair (Infracost)

Alistair (Infracost)

10/03/2022, 4:06 PM
what commands are you running when you see this?
g

Gianluca Di Vincenzo

10/03/2022, 4:07 PM
infracost breakdown --path .
Alistair (Infracost)

Alistair (Infracost)

10/03/2022, 4:11 PM
Okay, so just to check have you already done the following?1. Run
infracost auth login
and got the Infracost API key from
~/.config/infracost/credentials.yml
2. Updated the
INFRACOST_API_KEY
secret value in your k8s cluster with that value If so you can now check that the init job in k8s is running properly. Then you can set your local Infracost CLI version to hit your self-hosted pricing api using:
infracost configure set pricing_api_endpoint <http://localhost:4000>
infracost configure set api_key $SELF_HOSTED_INFRACOST_API_KEY
g

Gianluca Di Vincenzo

10/03/2022, 4:19 PM
exactly these steps that give me the error above
Alistair (Infracost)

Alistair (Infracost)

10/03/2022, 4:22 PM
Can you try the steps here to see if this helps narrow it down? https://www.infracost.io/docs/cloud_pricing_api/self_hosted/#troubleshooting
g

Gianluca Di Vincenzo

10/04/2022, 6:46 AM
Hi @Alistair (Infracost), thanks to your help and a bit of perseverance I solved the problem 🙂
9:03 AM
Hi @Alistair (Infracost) this morning I was able to complete all the installation steps of infracost self_hosted and I saw the result in the MR. Then I uninstalled and reinstalled the graph that worked before and started getting
(base) gianlucadivincenzo@MacBook-Pro-di-Gianluca terraform % kubectl logs -f infracost-cloud-pricing-api-57c5654784-fsjg7 -n infracost

> cloud-pricing-api@0.3.8 start
> node dist/server.js

{"level":30,"time":1664873913625,"pid":18,"hostname":"infracost-cloud-pricing-api-57c5654784-fsjg7","msg":"🚀  Server ready at <http://0.0.0.0:4000/>"}
{"level":50,"time":1664873919929,"pid":18,"hostname":"infracost-cloud-pricing-api-57c5654784-fsjg7","msg":"Could not connect to database: error: password authentication failed for user \"cloudpricingapi\""}
{"level":50,"time":1664873919938,"pid":18,"hostname":"infracost-cloud-pricing-api-57c5654784-fsjg7","msg":"Could not connect to database: error: password authentication failed for user \"cloudpricingapi\""}
{"level":50,"time":1664873924911,"pid":18,"hostname":"infracost-cloud-pricing-api-57c5654784-fsjg7","msg":"Could not connect to database: error: password authentication failed for user \"cloudpricingapi\""}
{"level":50,"time":1664873924912,"pid":18,"hostname":"infracost-cloud-pricing-api-57c5654784-fsjg7","msg":"Could not connect to database: error: password authentication failed for user \"cloudpricingapi\""}
{"level":50,"time":1664873929908,"pid":18,"hostname":"infracost-cloud-pricing-api-57c5654784-fsjg7","msg":"Could not connect to database: error: password authentication failed for user \"cloudpricingapi\""}
{"level":50,"time":1664873929915,"pid":18,"hostname":"infracost-cloud-pricing-api-57c5654784-fsjg7","msg":"Could not connect to database: error: password authentication failed for user \"cloudpricingapi\""}
{"level":50,"time":1664873929924,"pid":18,"hostname":"infracost-cloud-pricing-api-57c5654784-fsjg7","msg":"Could not connect to database: error: password authentication failed for user \"cloudpricingapi\""}
npm notice 
npm notice New minor version of npm available! 8.1.2 -> 8.19.2
npm notice Changelog: <<https://github.com/npm/cli/releases/tag/v8.19.2>>
npm notice Run `npm install -g npm@8.19.2` to update!
npm notice 
npm ERR! path /usr/src/app
npm ERR! command failed
npm ERR! signal SIGTERM
npm ERR! command sh -c node dist/server.js

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/infracost/.npm/_logs/2022-10-04T08_58_50_446Z-debug.log
among the logs of the pods it costs wrong now?
Alistair (Infracost)

Alistair (Infracost)

10/04/2022, 9:21 AM
@Gianluca Di Vincenzo I wonder if this is related to the bitnami postgresql chart issue where it overwrites the postgresql password. We have some details here: https://github.com/infracost/helm-charts/tree/master/charts/cloud-pricing-api#postgresql
g

Gianluca Di Vincenzo

10/04/2022, 9:28 AM
Thanks @Alistair (Infracost), I think this is the problem I also read another little thread about where you were talking about it. Also, question without postgresql in self_hosted can’t get the graph to work? Otherwise what parameters should I add? I already have infracostAPIKey
helm upgrade --install infracost infracost/cloud-pricing-api -f ./deploy/operators/infracost.yaml --namespace infracost --create-namespace --set infracostAPIKey='$INFRACOST_API_KEY' --set postgresql.postgresqlPassword='$INFRACOST_POSTGRES' --version 0.5.10
9:30 AM
in the ./deploy/operators/infracost.yaml file is this content but that it work correctly
api:
  tolerations:
  ...

  affinity:
    ...

job:
  tolerations:
  ...

  affinity:
    ...
Alistair (Infracost)

Alistair (Infracost)

10/04/2022, 9:33 AM
just the
infracostAPIKey
and
postgresql.postgresqlPassword
inputs should work, but if you’ve uninstalled you might need to delete the postgreSQL volume before you reinstall again
g

Gianluca Di Vincenzo

10/04/2022, 9:34 AM
Okay, I’ll try thanks 🙂
Alistair (Infracost)

Alistair (Infracost)

10/04/2022, 10:13 AM
@Gianluca Di Vincenzo awesome! Yeah Infracost Cloud only works with the SaaS setup so it will stop there, but you’ll still see comments in MRs.
g

Gianluca Di Vincenzo

10/04/2022, 10:15 AM
Perfect great product @Alistair (Infracost), in case we will evaluate the move to Cloud plan in the future. Thanks so much for the quick community support 😃 Great job 😃
Alistair (Infracost)

Alistair (Infracost)

10/04/2022, 10:16 AM
np 😒imple_smile: please reach out if you have any further issues
g

Gianluca Di Vincenzo

10/04/2022, 12:17 PM
Hi @Alistair (Infracost), forgive me again but I would like to implement improvements to the installation we have of infracost, that is to install Bitnami Postgres first and then your chart. It’s possible? If so, what parameters should be specified for Postgres first and then for your self_hosted chart? Thanks in advance 😉
Alistair (Infracost)

Alistair (Infracost)

10/04/2022, 1:30 PM
@Gianluca Di Vincenzo I think for this you’ll want to set
postgresql.enabled="false"
for the Cloud Pricing API chart, along with the
postgresql.external
parameters as per the example here: https://github.com/infracost/helm-charts/tree/master/charts/cloud-pricing-api#postgresql For the bitnami chart it depends on what version you use. We pass through all the other
postgresql.
variables to the bitnami chart, but I think the inputs have changed for newer versions looking at https://github.com/bitnami/charts/blob/master/bitnami/postgresql/README.md
g

Gianluca Di Vincenzo

10/04/2022, 3:00 PM
Wonderful @Alistair (Infracost) it work your suggestion 🎉