GCP Configuration
In order to get cost data for your cluster running on Google Kubernetes Engine (GKE), you’ll need to set up an API key for Google Cloud's Cloud Billing API. This enables the Randoli agent, through OpenCost, to get the price of your kubernetes nodes.
1) Enable the Cloud Billing API if not enabled already
- Step 1.1 - Go to https://console.cloud.google.com/flows/enableapi?apiid=cloudbilling.googleapis.com
- Step 1.2 - Confirm the project and press NEXT
- Step 1.3 - Press the ENABLE button
2) Generate an API key with the appropriate access permissions.
- Step 2.1 - Go to Google Cloud's Credentials page: https://console.cloud.google.com/apis/credentials
- Step 2.2 - Make sure the correct project (same as step 1.2) is selected
- Step 2.3 - Click on CREATE CREDENTIALS and select "API Key". At this point an API key will be created with an auto-generated name. Please copy the value of "Your API Key".
- Step 2.4 - Edit the generated API key so that it only has the necessary permissions. Click on "Edit API key"
- Step 2.5 - (OPTIONAL) Change the API key name. Suggestion: "Randoli Opencost Integration"
- Step 2.6 - On the "API restriction" section, select the "Restrict Key" option. On the dropdown, select only the "Cloud Billing API" and then save it.
3) Add the API key to the helm chart installation
During the agent installation you must add an extra param on the helm chart command. Please add the param as follows:
--set costManagement.opencost.exporter.cloudProviderApiKey='<YOUR_GOOGLE_API_KEY_HERE>'
If the helm chart was already installed you can use the helm upgrade
command to set only the extra param, as follows:
helm upgrade randoli randoli/randoli-agent -n randoli-agents --set costManagement.opencost.exporter.cloudProviderApiKey='<YOUR_GOOGLE_API_KEY_HERE>' --reuse-values