-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding configuration page for Linode integration
Signed-off-by: Richard Kovacs <[email protected]>
- Loading branch information
Richard Kovacs
committed
Aug 19, 2024
1 parent
2ffe803
commit b0141bd
Showing
1 changed file
with
149 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
--- | ||
sidebar_position: 1 | ||
title: Linode | ||
--- | ||
import CloudCosts from './_cloud_costs.mdx'; | ||
import CloudCostsInfo from './_cloud_costs_info.mdx'; | ||
import CustomPrometheus from './_custom_prometheus.mdx'; | ||
import Helm from './_helm.mdx'; | ||
import InstallCloudCosts from './_install_cloud_costs.mdx'; | ||
import InstallManifest from './_install_manifest.mdx'; | ||
import InstallOpenCost from './_install_opencost.mdx'; | ||
import InstallPrometheus from './_install_prometheus.mdx'; | ||
import Installing from './_installing.mdx'; | ||
import Namespace from './_namespace.mdx'; | ||
import UpdateOpenCost from './_update_opencost.mdx'; | ||
|
||
# Installing on Linode | ||
|
||
OpenCost may be installed on Kubernetes clusters running on Linode Kubernetes Service (LKS). | ||
<Installing/> | ||
|
||
## Install Prometheus | ||
|
||
<InstallPrometheus/> | ||
<CustomPrometheus/> | ||
|
||
## Create the OpenCost Namespace | ||
|
||
<Namespace/> | ||
|
||
## Linode Configuration | ||
|
||
### Cost Allocation | ||
|
||
OpenCost will automatically read the node information `node.spec.providerID` to determine the cloud service provider (CSP) in use. If it detects the CSP is LKE, it will attempt to pull the Linode on-demand pricing with no further configuration required. | ||
|
||
### Custom Pricing | ||
|
||
```yaml | ||
opencost: | ||
customPricing: | ||
enabled: true | ||
configmapName: pricing-configs | ||
provider: linode | ||
costModel: | ||
description: Modified Linode prices | ||
linodeTokenSecret: Modified token secret namespaced name | ||
zoneNetworkEgress: 0.0 | ||
regionNetworkEgress: 0.0 | ||
internetNetworkEgress: 0.0 | ||
defaultLBPrice: 0.15 | ||
controlPlaneCosts: 0.0 | ||
HaControlPlaneCosts: 0.9 | ||
``` | ||
#### Security for Linode integration | ||
OpenCost uses the [Linode SDK for Go](https://github.com/linode/linodego) to pull price data. | ||
Linode integration works out of the box, uses the token deployed by default `kube-system/linode`, but OpenCost doesn't have permission to use it. | ||
|
||
Please create the following role and binding to ensure permissions. | ||
|
||
```yaml | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: get-secret-linode | ||
rules: | ||
- apiGroups: [""] | ||
resources: ["secrets"] | ||
resourceNames: ["linode"] | ||
verbs: ["get"] | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: opencost-secret-access-linode | ||
subjects: | ||
- kind: ServiceAccount | ||
name: opencost | ||
namespace: default | ||
roleRef: | ||
kind: ClusterRole | ||
name: get-secret-linode | ||
apiGroup: rbac.authorization.k8s.io | ||
``` | ||
|
||
Sometimes it makes sense to maintane separated token or solving rotation of token. | ||
|
||
First create [Linode API token](https://cloud.linode.com/profile/tokens) with Read-Only Kubernetes access. | ||
|
||
Create your own secret. | ||
|
||
```bash | ||
kubectl apply -f - <<EOF | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: linode | ||
namespace: opencost | ||
type: Opaque | ||
data: | ||
token: $(echo -n $LINODE_TOKEN | base64) | ||
EOF | ||
``` | ||
|
||
Ensure permissions to read secret. | ||
|
||
Configure custom pricing. | ||
|
||
```yaml | ||
opencost: | ||
customPricing: | ||
enabled: true | ||
configmapName: pricing-configs | ||
provider: linode | ||
costModel: | ||
linodeTokenSecret: opencost/linode | ||
``` | ||
|
||
> Alternatively you can overwrite secret via Helm value `opencost.exporter.linode.tokenSecret`. | ||
|
||
## Linode Cloud Costs | ||
|
||
<!-- CloudCostsInfo/ --> | ||
|
||
Cloud Cost integration isn't supported at the moment. | ||
|
||
<!-- InstallCloudCosts/ --> | ||
<!-- CloudCosts/ --> | ||
|
||
## Install OpenCost | ||
|
||
<Helm/> | ||
|
||
### Using the OpenCost Helm Chart | ||
|
||
<InstallOpenCost/> | ||
|
||
### Updating OpenCost via Helm | ||
|
||
<UpdateOpenCost/> | ||
|
||
### Installing with the OpenCost Manifest | ||
|
||
Installing from the OpenCost manifest is supported on Linode. | ||
|
||
<InstallManifest/> |