|
| 1 | +--- |
| 2 | +sidebar_position: 1 |
| 3 | +title: Linode |
| 4 | +--- |
| 5 | +import CloudCosts from './_cloud_costs.mdx'; |
| 6 | +import CloudCostsInfo from './_cloud_costs_info.mdx'; |
| 7 | +import CustomPrometheus from './_custom_prometheus.mdx'; |
| 8 | +import Helm from './_helm.mdx'; |
| 9 | +import InstallCloudCosts from './_install_cloud_costs.mdx'; |
| 10 | +import InstallManifest from './_install_manifest.mdx'; |
| 11 | +import InstallOpenCost from './_install_opencost.mdx'; |
| 12 | +import InstallPrometheus from './_install_prometheus.mdx'; |
| 13 | +import Installing from './_installing.mdx'; |
| 14 | +import Namespace from './_namespace.mdx'; |
| 15 | +import UpdateOpenCost from './_update_opencost.mdx'; |
| 16 | + |
| 17 | +# Installing on Linode |
| 18 | + |
| 19 | +OpenCost may be installed on Kubernetes clusters running on Linode Kubernetes Service (LKS). |
| 20 | +<Installing/> |
| 21 | + |
| 22 | +## Install Prometheus |
| 23 | + |
| 24 | +<InstallPrometheus/> |
| 25 | +<CustomPrometheus/> |
| 26 | + |
| 27 | +## Create the OpenCost Namespace |
| 28 | + |
| 29 | +<Namespace/> |
| 30 | + |
| 31 | +## Linode Configuration |
| 32 | + |
| 33 | +### Cost Allocation |
| 34 | + |
| 35 | +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. |
| 36 | + |
| 37 | +### Custom Pricing |
| 38 | + |
| 39 | +Custom Pricing is not fully supported by Linode provider. Only the following values are free to change. |
| 40 | + |
| 41 | +```yaml |
| 42 | +opencost: |
| 43 | + customPricing: |
| 44 | + enabled: true |
| 45 | + configmapName: pricing-configs |
| 46 | + provider: linode |
| 47 | + costModel: |
| 48 | + description: Modified Linode prices |
| 49 | + linodeTokenSecret: Modified token secret namespaced name |
| 50 | + zoneNetworkEgress: 0.0 |
| 51 | + regionNetworkEgress: 0.0 |
| 52 | + internetNetworkEgress: 0.0 |
| 53 | + defaultLBPrice: 0.15 |
| 54 | + controlPlaneCosts: 0.0 |
| 55 | + HaControlPlaneCosts: 0.9 |
| 56 | +``` |
| 57 | +
|
| 58 | +#### Security for Linode integration |
| 59 | +
|
| 60 | +OpenCost uses the [Linode SDK for Go](https://github.com/linode/linodego) to pull price data. |
| 61 | +
|
| 62 | +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. |
| 63 | + |
| 64 | +Please create the following role and binding to ensure permissions. |
| 65 | + |
| 66 | +```yaml |
| 67 | +apiVersion: rbac.authorization.k8s.io/v1 |
| 68 | +kind: ClusterRole |
| 69 | +metadata: |
| 70 | + name: get-secret-linode |
| 71 | +rules: |
| 72 | + - apiGroups: [""] |
| 73 | + resources: ["secrets"] |
| 74 | + resourceNames: ["linode"] |
| 75 | + verbs: ["get"] |
| 76 | +--- |
| 77 | +apiVersion: rbac.authorization.k8s.io/v1 |
| 78 | +kind: ClusterRoleBinding |
| 79 | +metadata: |
| 80 | + name: opencost-secret-access-linode |
| 81 | +subjects: |
| 82 | + - kind: ServiceAccount |
| 83 | + name: opencost |
| 84 | + namespace: default |
| 85 | +roleRef: |
| 86 | + kind: ClusterRole |
| 87 | + name: get-secret-linode |
| 88 | + apiGroup: rbac.authorization.k8s.io |
| 89 | +``` |
| 90 | + |
| 91 | +Sometimes it makes sense to maintane separated token or solving rotation of token. |
| 92 | + |
| 93 | +First create [Linode API token](https://cloud.linode.com/profile/tokens) with Read-Only Kubernetes access. |
| 94 | + |
| 95 | +Create your own secret. |
| 96 | + |
| 97 | +```bash |
| 98 | +kubectl apply -f - <<EOF |
| 99 | +apiVersion: v1 |
| 100 | +kind: Secret |
| 101 | +metadata: |
| 102 | + name: linode |
| 103 | + namespace: opencost |
| 104 | +type: Opaque |
| 105 | +data: |
| 106 | + token: $(echo -n "$LINODE_TOKEN" | base64 -w0) |
| 107 | +EOF |
| 108 | +``` |
| 109 | + |
| 110 | +Ensure permissions to read secret. |
| 111 | + |
| 112 | +```yaml |
| 113 | +apiVersion: rbac.authorization.k8s.io/v1 |
| 114 | +kind: Role |
| 115 | +metadata: |
| 116 | + name: get-secret-linode |
| 117 | + namespace: opencost |
| 118 | +rules: |
| 119 | + - apiGroups: [""] |
| 120 | + resources: ["secrets"] |
| 121 | + resourceNames: ["linode"] |
| 122 | + verbs: ["get"] |
| 123 | +--- |
| 124 | +apiVersion: rbac.authorization.k8s.io/v1 |
| 125 | +kind: RoleBinding |
| 126 | +metadata: |
| 127 | + name: opencost-secret-access-linode |
| 128 | + namespace: opencost |
| 129 | +subjects: |
| 130 | + - kind: ServiceAccount |
| 131 | + name: opencost |
| 132 | + namespace: opencost |
| 133 | +roleRef: |
| 134 | + kind: Role |
| 135 | + name: get-secret-linode |
| 136 | + apiGroup: rbac.authorization.k8s.io |
| 137 | +``` |
| 138 | + |
| 139 | +Configure custom pricing. |
| 140 | + |
| 141 | +```yaml |
| 142 | +opencost: |
| 143 | + customPricing: |
| 144 | + enabled: true |
| 145 | + configmapName: pricing-configs |
| 146 | + provider: linode |
| 147 | + costModel: |
| 148 | + linodeTokenSecret: opencost/linode |
| 149 | +``` |
| 150 | + |
| 151 | +> Alternatively you can overwrite secret via Helm value `opencost.exporter.linode.tokenSecret`. |
| 152 | + |
| 153 | +## Linode Cloud Costs |
| 154 | + |
| 155 | +<!-- CloudCostsInfo/ --> |
| 156 | + |
| 157 | +Cloud Cost integration isn't supported at the moment. |
| 158 | + |
| 159 | +<!-- InstallCloudCosts/ --> |
| 160 | +<!-- CloudCosts/ --> |
| 161 | + |
| 162 | +## Install OpenCost |
| 163 | + |
| 164 | +<Helm/> |
| 165 | + |
| 166 | +### Using the OpenCost Helm Chart |
| 167 | + |
| 168 | +<InstallOpenCost/> |
| 169 | + |
| 170 | +### Updating OpenCost via Helm |
| 171 | + |
| 172 | +<UpdateOpenCost/> |
| 173 | + |
| 174 | +### Installing with the OpenCost Manifest |
| 175 | + |
| 176 | +Installing from the OpenCost manifest is supported on Linode. |
| 177 | + |
| 178 | +<InstallManifest/> |
0 commit comments