<@U044R6T7W59> did the init job complete okay? I’m...
# general
l
@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
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
@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
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
what commands are you running when you see this?
m
infracost breakdown --path .
l
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
exactly these steps that give me the error above
l
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
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
@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
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
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
Okay, I’ll try thanks 🙂
l
@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
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
np simple smile please reach out if you have any further issues
m
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
@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
Wonderful @little-author-61621 it work your suggestion 🎉✌️