Service Key Rotation
Cloud provider service keys can be used in various aspects of the Kubecost installation. This includes integrating your cloud provider billing data with Kubecost, setting up multi-cluster environments, and backing up data. While automated IAM authentication via a Kubernetes service account like AWS IRSA is recommended, there are some scenarios where key-based authentication is preferred. When this method is used, rotating the keys at a pre-defined interval is a security best practice. Combinations of these features can be used, and therefore you may need to follow one or more of the below steps.
Cloud billing integration keys
Update the Kubernetes secret containing the
cloud-integration.json
with the newly rotated key. See Cloud Integrations for more configuration details.Restart the
cloud-cost
pod if it exists, otherwise restart thecost-analyzer
pod.Verify the new key is working correctly. Any authentication errors should be present early in the container logs. Additionally, you can check the status of the cloud integration in the Kubecost UI via Settings > View Full Diagnostics.
Multi-cluster keys
There are two methods for enabling multi-clustering in Kubecost:
Depending on which method you are using, the key rotation process differs.
Federated-ETL
With Federated ETL objects, storage keys can be provided in two ways. The preferred method is using the secret defined by the Helm value .Values.kubecostModel.federatedStorageConfigSecret
.
Update the appropriate Kubernetes secret with the new key on each cluster.
Restart the Kubecost
cost-analyzer
pod.If it exists, restart the
aggregator
pod.Verify the new key is working correctly by checking the container logs for any object storage authentication errors.
Thanos
Thanos federation makes use of the kubecost-thanos
Kubernetes secret as described here.
Update the
kubecost-thanos
Kubernetes secret with the new key on each cluster.Restart the
prometheus
server pod installed with Kubecost on all clusters (including the primary cluster) that write data to the Thanos object store. This will ensure the Thanos sidecar has the new key.On the primary Kubecost cluster, restart the
thanos-store
pod.Verify the new key is working correctly by checking the
thanos-sidecar
logs in theprometheus
server pods for authentication errors to ensure they are able to write new block data to the object storage.Verify the new key is working correctly by checking
thanos-store
pod logs on the primary cluster for authentication errors to ensure it is able to read block data from the object storage.
Last updated