https://infracost.io logo
#general
Title
# general
l

little-author-61621

10/03/2022, 3:14 PM
@mysterious-kitchen-14875 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.
m

mysterious-kitchen-14875

10/03/2022, 3:30 PM
Hi @little-author-61621 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.
l

little-author-61621

10/03/2022, 3:40 PM
@mysterious-kitchen-14875 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.
m

mysterious-kitchen-14875

10/03/2022, 4:05 PM
Thanks for the tip I keep trying, in this case I get
Copy code
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.
l

little-author-61621

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

mysterious-kitchen-14875

10/03/2022, 4:07 PM
infracost breakdown --path .
l

little-author-61621

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:
Copy code
infracost configure set pricing_api_endpoint <http://localhost:4000>
infracost configure set api_key $SELF_HOSTED_INFRACOST_API_KEY
m

mysterious-kitchen-14875

10/03/2022, 4:19 PM
exactly these steps that give me the error above
l

little-author-61621

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
m

mysterious-kitchen-14875

10/04/2022, 6:46 AM
Hi @little-author-61621, thanks to your help and a bit of perseverance I solved the problem 🙂
Hi @little-author-61621 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
Copy code
(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?
l

little-author-61621

10/04/2022, 9:21 AM
@mysterious-kitchen-14875 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
m

mysterious-kitchen-14875

10/04/2022, 9:28 AM
Thanks @little-author-61621, 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
in the ./deploy/operators/infracost.yaml file is this content but that it work correctly
Copy code
api:
  tolerations:
  ...

  affinity:
    ...

job:
  tolerations:
  ...

  affinity:
    ...
l

little-author-61621

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
m

mysterious-kitchen-14875

10/04/2022, 9:34 AM
Okay, I’ll try thanks 🙂
l

little-author-61621

10/04/2022, 10:13 AM
@mysterious-kitchen-14875 awesome! Yeah Infracost Cloud only works with the SaaS setup so it will stop there, but you’ll still see comments in MRs.
m

mysterious-kitchen-14875

10/04/2022, 10:15 AM
Perfect great product @little-author-61621, in case we will evaluate the move to Cloud plan in the future. Thanks so much for the quick community support :) Great job :)
l

little-author-61621

10/04/2022, 10:16 AM
np simple smile please reach out if you have any further issues
m

mysterious-kitchen-14875

10/04/2022, 12:17 PM
Hi @little-author-61621, 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 😉
l

little-author-61621

10/04/2022, 1:30 PM
@mysterious-kitchen-14875 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
m

mysterious-kitchen-14875

10/04/2022, 3:00 PM
Wonderful @little-author-61621 it work your suggestion 🎉✌️
2 Views