-
Notifications
You must be signed in to change notification settings - Fork 400
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #87 from pb82/grafana-ha
add grafana/postgres ha example
- Loading branch information
Showing
5 changed files
with
104 additions
and
1 deletion.
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,15 @@ | ||
# High Availability Deployment | ||
|
||
This example demonstrates how to deploy Grafana in high availability mode running multiple replicas and using Postgres as a database. | ||
|
||
Grafana will by default also use the database for session storage. To keep user sessions separate, the `remote_cache` configuration can be used. | ||
|
||
## Installation | ||
|
||
1. Make sure the operator is running, then create the templates in this directory: | ||
|
||
```shell script | ||
$ kubectl apply -f deploy/examples/ha | ||
``` | ||
|
||
*NOTE:* This examples uses an `emptyDir` storage for Postgres and is only meant for demo purposes. |
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,27 @@ | ||
apiVersion: integreatly.org/v1alpha1 | ||
kind: Grafana | ||
metadata: | ||
name: example-grafana | ||
spec: | ||
deployment: | ||
replicas: 2 | ||
ingress: | ||
enabled: True | ||
config: | ||
log: | ||
mode: "console" | ||
level: "warn" | ||
auth: | ||
disable_login_form: False | ||
disable_signout_menu: True | ||
auth.anonymous: | ||
enabled: True | ||
database: | ||
type: postgres | ||
host: postgres:5432 | ||
name: grafana | ||
user: grafana | ||
password: grafana | ||
dashboardLabelSelector: | ||
- matchExpressions: | ||
- {key: app, operator: In, values: [grafana]} |
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,60 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: postgres | ||
labels: | ||
app: postgres | ||
spec: | ||
ports: | ||
- port: 5432 | ||
targetPort: 5432 | ||
name: postgres | ||
selector: | ||
app: postgres | ||
--- | ||
apiVersion: extensions/v1beta1 | ||
kind: Deployment | ||
metadata: | ||
name: postgres | ||
spec: | ||
replicas: 1 | ||
template: | ||
metadata: | ||
labels: | ||
app: postgres | ||
spec: | ||
containers: | ||
- name: postgres | ||
image: postgres:11.5 | ||
imagePullPolicy: "IfNotPresent" | ||
livenessProbe: | ||
timeoutSeconds: 1 | ||
initialDelaySeconds: 5 | ||
tcpSocket: | ||
port: 5432 | ||
readinessProbe: | ||
timeoutSeconds: 1 | ||
initialDelaySeconds: 5 | ||
exec: | ||
command: | ||
- /bin/sh | ||
- -c | ||
- psql -h 127.0.0.1 -U $POSTGRES_USER -q -d $POSTGRES_DB -c 'SELECT 1' | ||
ports: | ||
- containerPort: 5432 | ||
env: | ||
- name: POSTGRES_USER | ||
value: grafana | ||
- name: POSTGRES_PASSWORD | ||
value: grafana | ||
- name: POSTGRES_DB | ||
value: grafana | ||
- name: PGDATA | ||
value: /var/lib/postgresql/data/pgdata | ||
volumeMounts: | ||
- mountPath: /var/lib/postgresql/data | ||
name: postgredb | ||
volumes: | ||
- name: postgredb | ||
emptyDir: {} |
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
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