-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added grafana helm chart and ingress (#125)
Signed-off-by: jorge-perez <[email protected]>
- Loading branch information
Showing
5 changed files
with
550 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,125 @@ | ||
# Install the grafana helm chart | ||
|
||
--- | ||
|
||
## Recommended to create secret client file instead of putting info in cli | ||
|
||
Example secret file: | ||
|
||
``` | ||
apiVersion: v1 | ||
data: | ||
client_id: BASE64_ENCODED_CLIENT_ID | ||
client_secret: BASE64_ENCODED_CLIENT_SECRET | ||
kind: Secret | ||
metadata: | ||
name: azure-client | ||
namespace: grafana | ||
type: Opaque | ||
``` | ||
|
||
--- | ||
|
||
## Create a datasources yaml file to prepopulate grafana with your datasources. | ||
|
||
example datasources yaml file: | ||
|
||
``` | ||
datasources: | ||
datasources.yaml: | ||
apiVersion: 1 | ||
datasources: | ||
- name: Prometheus | ||
type: prometheus | ||
access: proxy | ||
url: http://kube-prometheus-stack-prometheus.prometheus.svc.cluster.local:9090 | ||
isDefault: true | ||
- name: Loki | ||
type: loki | ||
access: proxy | ||
url: http://loki-gateway.{{ .Release.Namespace }}.svc.cluster.local:80 | ||
editable: false | ||
``` | ||
|
||
--- | ||
|
||
## Create your ssl files | ||
|
||
Your cert file should look something like the following. | ||
|
||
example cert file: | ||
|
||
``` | ||
-----BEGIN CERTIFICATE----- | ||
MIID0DCCArigAwIBAgIBATANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJGUjET | ||
MBEGA1UECAwKU29tZS1TdGF0ZTEOMAwGA1UEBwwFUGFyaXMxDTALBgNVBAoMBERp | ||
bWkxDTALBgNVBAsMBE5TQlUxEDAOBgNVBAMMB0RpbWkgQ0ExGzAZBgkqhk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ANf6vXvUizyvwDrPRv/kfvLNa3ZPnLMMxU98Mvh | ||
PXy3PkB8++6U4Y3vdk2Ni2WYYlIls8yqbM4327IKmkDc2TimS8u60CT47mKU7aDY | ||
cbTV5RDkrlaYwm5yqlTIglvCv7o= | ||
-----END CERTIFICATE----- | ||
``` | ||
|
||
example key file: | ||
|
||
``` | ||
-----BEGIN RSA PRIVATE KEY----- | ||
MIIEowIBAAKCAQEAvpnaPKLIKdvx98KW68lz8pGaRRcYersNGqPjpifMVjjE8LuC | ||
oXgPU0HePnNTUjpShBnynKCvrtWhN+haKbSp+QWXSxiTrW99HBfAl1MDQyWcukoE | ||
b9Cw6INctVUN4iRvkn9T8E6q174RbcnwA/7yTc7p1NCvw+6B/aAN9l1G2pQXgRdY | ||
C/+G6o1IZEHtWhqzE97nY5QKNuUVD0V09dc5CDYBaKjqetwwv6DFk/GRdOSEd/6b | ||
W+20z0qSHpa3YNW6qSp+x5pyYmDrzRIR03os6DauZkChSRyc/Whvurx6o85D6qpz | ||
ywo8xwNaLZHxTQPgcIA5su9ZIytv9LH2E+lSwwIDAQABAoIBAFml8cD9a5pMqlW3 | ||
f9btTQz1sRL4Fvp7CmHSXhvjsjeHwhHckEe0ObkWTRsgkTsm1XLu5W8IITnhn0+1 | ||
iNr+78eB+rRGngdAXh8diOdkEy+8/Cee8tFI3jyutKdRlxMbwiKsouVviumoq3fx | ||
OGQYwQ0Z2l/PvCwy/Y82ffq3ysC5gAJsbBYsCrg14bQo44ulrELe4SDWs5HCjKYb | ||
EI2b8cOMucqZSOtxg9niLN/je2bo/I2HGSawibgcOdBms8k6TvsSrZMr3kJ5O6J+ | ||
77LGwKH37brVgbVYvbq6nWPL0xLG7dUv+7LWEo5qQaPy6aXb/zbckqLqu6/EjOVe | ||
ydG5JQECgYEA9kKfTZD/WEVAreA0dzfeJRu8vlnwoagL7cJaoDxqXos4mcr5mPDT | ||
kbWgFkLFFH/AyUnPBlK6BcJp1XK67B13ETUa3i9Q5t1WuZEobiKKBLFm9DDQJt43 | ||
uKZWJxBKFGSvFrYPtGZst719mZVcPct2CzPjEgN3Hlpt6fyw3eOrnoECgYEAxiOu | ||
jwXCOmuGaB7+OW2tR0PGEzbvVlEGdkAJ6TC/HoKM1A8r2u4hLTEJJCrLLTfw++4I | ||
ddHE2dLeR4Q7O58SfLphwgPmLDezN7WRLGr7Vyfuv7VmaHjGuC3Gv9agnhWDlA2Q | ||
gBG9/R9oVfL0Dc7CgJgLeUtItCYC31bGT3yhV0MCgYEA4k3DG4L+RN4PXDpHvK9I | ||
pA1jXAJHEifeHnaW1d3vWkbSkvJmgVf+9U5VeV+OwRHN1qzPZV4suRI6M/8lK8rA | ||
Gr4UnM4aqK4K/qkY4G05LKrik9Ev2CgqSLQDRA7CJQ+Jn3Nb50qg6hFnFPafN+J7 | ||
7juWln08wFYV4Atpdd+9XQECgYBxizkZFL+9IqkfOcONvWAzGo+Dq1N0L3J4iTIk | ||
w56CKWXyj88d4qB4eUU3yJ4uB4S9miaW/eLEwKZIbWpUPFAn0db7i6h3ZmP5ZL8Q | ||
qS3nQCb9DULmU2/tU641eRUKAmIoka1g9sndKAZuWo+o6fdkIb1RgObk9XNn8R4r | ||
psv+aQKBgB+CIcExR30vycv5bnZN9EFlIXNKaeMJUrYCXcRQNvrnUIUBvAO8+jAe | ||
CdLygS5RtgOLZib0IVErqWsP3EI1ACGuLts0vQ9GFLQGaN1SaMS40C9kvns1mlDu | ||
LhIhYpJ8UsCVt5snWo2N+M+6ANh5tpWdQnEK6zILh4tRbuzaiHgb | ||
-----END RSA PRIVATE KEY----- | ||
``` | ||
|
||
--- | ||
|
||
## Add repo and install | ||
|
||
``` | ||
helm repo add grafana https://grafana.github.io/helm-charts | ||
helm repo update | ||
kubectl create ns grafana | ||
kubectl -n grafana create secret tls grafana-tls-public --cert=YOUR_CERT_FILE --key=YOUR_KEY_FILE | ||
kubectl -n grafana create secret generic azure-client --type Opaque --from-literal=client_id="YOUR_CLIENT_ID" --from-literal=client_secret="YOUR_CLIENT_SECRET" | ||
OR | ||
kubectl -n grafana apply -f azure-secrets.yaml | ||
helm upgrade --install grafana grafana/grafana --namespace grafana --values overrides.yaml -f datasources.yaml --set tenant_id=YOUR_TENANT_ID --set custom_host=YOUR_URL_FOR_INGRESS | ||
``` |
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,14 @@ | ||
datasources: | ||
datasources.yaml: | ||
apiVersion: 1 | ||
datasources: | ||
- name: Prometheus | ||
type: prometheus | ||
access: proxy | ||
url: http://kube-prometheus-stack-prometheus.prometheus.svc.cluster.local:9090 | ||
isDefault: true | ||
- name: Loki | ||
type: loki | ||
access: proxy | ||
url: http://loki-gateway.{{ .Release.Namespace }}.svc.cluster.local:80 | ||
editable: false |
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,57 @@ | ||
custom_host: grafana.example.com # TODO: update this value. Can be set in CLI. | ||
tenant_id: 122333 # TODO: update this value. Can be set in CLI. | ||
|
||
|
||
ingress: | ||
enabled: true | ||
annotations: | ||
nginx.ingress.kubernetes.io/rewrite-target: / | ||
path: / | ||
pathType: ImplementationSpecific | ||
|
||
hosts: | ||
- "{{ .Values.custom_host }}" # Ref: custom_host variable above | ||
tls: | ||
- hosts: | ||
- "{{ .Values.custom_host }}" # Ref: custom_host variable above | ||
secretName: grafana-tls-public | ||
|
||
|
||
extraSecretMounts: | ||
- name: azure-client-secret-mount | ||
secretName: azure-client | ||
defaultMode: 0440 | ||
mountPath: /etc/secrets/azure-client | ||
readOnly: true | ||
nodeSelector: | ||
openstack-control-plane: enabled | ||
grafana.ini: | ||
paths: | ||
data: /var/lib/grafana/ | ||
logs: /var/log/grafana | ||
plugins: /var/lib/grafana/plugins | ||
provisioning: /etc/grafana/provisioning | ||
analytics: | ||
check_for_updates: true | ||
log: | ||
mode: console | ||
grafana_net: | ||
url: https://grafana.net | ||
server: | ||
domain: "{{ .Values.custom_host }}" # Ref: custom_host variable above | ||
root_url: "https://{{ .Values.custom_host }}" # Ref: custom_host variable above | ||
auth.azuread: | ||
name: Azure AD | ||
enabled: true | ||
allow_sign_up: true | ||
auto_login: false | ||
client_id: $__file{/etc/secrets/azure-client/client_id} | ||
client_secret: $__file{/etc/secrets/azure-client/client_secret} | ||
scopes: openid email profile | ||
auth_url: "https://login.microsoftonline.com/{{ .Values.tenant_id }}/oauth2/v2.0/authorize" | ||
token_url: "https://login.microsoftonline.com/{{ .Values.tenant_id }}/oauth2/v2.0/token" | ||
allowed_organizations: "{{ .Values.tenant_id }}" | ||
role_attribute_strict: false | ||
allow_assign_grafana_admin: false | ||
skip_org_role_sync: false | ||
use_pkce: true |
Oops, something went wrong.