3.3. Kubernetes Installation
You may want to choose an Kubernetes Cluster installation if you are using the Kubernetes Container Platform to deploy your applications.
If you want to install on Kubernetes via Helm Chart please see chapter HelmChart Installation.
3.3.1. Prerequisites
Please make sure that you provide the following prerequisites:
-
a valid licence file is needed (get it at speedgain.com)
-
a Kubernetes Container Platform accessible via kubectl terminal command
-
4 CPU Cores, 16GB RAM and at least 100GB to store data
-
a modern web-browser
3.3.2. Services
One service can’t be run on its own. It has to be executed in a compose with 5 other services (all available on Docker-Hub and via ITGAIN download portal: itgain.sharefile.eu ). The list of all 6 images:
-
Speedgain TimescaleDB - as the repository to store all performance metrics
-
Speedgain Collector - the core component to pull metrics
-
Speedgain Service - rest api service
-
Speedgain Frontend - web-frontend
-
Speedgain Grafana - delivering all needed dashboards
-
NginX - as reverse proxy
3.3.3. Install Step-by-Step
To install and run Speedgain for Databases as a Kubernetes Cluster installation follow these steps:
-
Get at least a trial license via speedgain.com
-
You may want to download and extract the Speedgain Kubernetes all files package
-
Copy or create the Kubernetes NginX configuration file nginx.conf to your file system
-
The Nginx configuration file must be made available in the Kubernetes Cluster. To do this, the provided file must be created as a ConfigMap with the following command:
kubectl create configmap s4dbs-nginx-conf --from-file nginx.conf
-
Create a secret named "s4dbs-secrets". Add a key called "postgres-password" with the desired performance database password as value. You may want to use the Speedgain secrets configuration file s4dbs-secrets.yaml via
kubectl apply -f s4dbs-secrets.yaml
-
Provide a persistent volume claim called "s4dbs-postgres-pv-claim" to persist the collected performance data. The size depends on the databases to be monitored. A good value is 100 GB.
-
Provide a persistent volume claim called "s4dbs-grafana-dashboards-pv-claim" to persist the dashboards used in Grafana to visualize the performance data. A good value for its size is 1 GB.
-
Provide a persistent volume claim called "s4dbs-grafana-pv-claim" to persist the application data of Grafana. A good value for its size is 10 GB.
-
Review the provided deployment YAML files. Verify that the docker images can be accessed in your Kubernetes cluster. If you do not have direct access to Docker-Hub, download images from our download portal and transfer to the docker repository used by your Kubernetes Cluster via
docker load --input s4dbs_<version>_linux_<amd64/arm64>_all_images.tar.gz
-
Import the Speedgain Timescale deployment file s4dbs-postgres.yaml via
kubectl apply -f s4dbs-postgres.yaml
-
Import the Speedgain Collector deployment file s4dbs-collector.yaml via
kubectl apply -f s4dbs-collector.yaml
-
Import the Speedgain Service deployment file s4dbs-service.yaml via
kubectl apply -f s4dbs-service.yaml
-
Review the Speedgain Grafana deployment file s4dbs-grafana.yaml. Replace the <enter host hostname here> tags with the hostname of your application. Import the file via
kubectl apply -f s4dbs-grafana.yaml
-
Review the Speedgain Web Frontend deployment file s4dbs-frontend.yaml. Replace the <enter host hostname here> tags with the hostname of your application. Import the file via
kubectl apply -f s4dbs-frontend.yaml
-
Import the Speedgain Reverse Proxy deployment file s4dbs-reverse.yaml via
kubectl apply -f s4dbs-reverse.yaml
3.3.4. Customization Options
For customization options, please review the Docker Compose installation section.
3.3.5. Speedgain Kubernetes all files package
3.3.6. Speedgain Collector deployment file s4dbs-collector.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: s4dbs-collector
name: s4dbs-collector-deployment
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
app: s4dbs-collector
template:
metadata:
labels:
app: s4dbs-collector
spec:
containers:
- name: s4dbs-collector
image: docker.io/itgainis/s4dbs_collector:2.1.1
imagePullPolicy: Always
env:
- name: PDB_DB_NAME
value: speedgain
- name: PDB_HOST
value: s4dbs-postgres-service
- name: PDB_PASS
valueFrom:
secretKeyRef:
name: s4dbs-secrets
key: postgres-password
- name: PDB_PORT
value: "5432"
- name: PDB_USER
value: postgres
- name: SPGLOGLEVEL
value: DEBUG
resources:
requests:
memory: "2Gi"
cpu: "0.5"
limits:
memory: "8Gi"
cpu: "4"
readinessProbe:
exec:
command: ["sh", "-c", "ps", "aux", "|", "grep", "java", "|", "grep", "Speedgain_for_Databases.jar"]
failureThreshold: 60
periodSeconds: 10
livenessProbe:
exec:
command: ["sh", "-c", "ps", "aux", "|", "grep", "java", "|", "grep", "Speedgain_for_Databases.jar"]
failureThreshold: 5
periodSeconds: 10
startupProbe:
exec:
command: ["sh", "-c", "ps", "aux", "|", "grep", "java", "|", "grep", "Speedgain_for_Databases.jar"]
failureThreshold: 60
periodSeconds: 10
restartPolicy: Always
volumes:
- name: s4dbs-licence
configMap:
name: s4dbs-licence
3.3.7. Speedgain Timescale deployment file s4dbs-postgres.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: s4dbs-postgres
name: s4dbs-postgres-deployment
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
app: s4dbs-postgres
template:
metadata:
labels:
app: s4dbs-postgres
spec:
volumes:
- name: postgres-pv-storage
persistentVolumeClaim:
claimName: s4dbs-postgres-pv-claim
initContainers:
- name: s4dbs-postgres-migration
image: docker.io/itgainis/s4dbs_timescaledb:2.1.1
imagePullPolicy: Always
env:
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: s4dbs-secrets
key: postgres-password
- name: POSTGRES_DB
value: speedgain
- name: OLD_DATA_DIR
value: /var/lib/postgresql/data/pgdata
- name: NEW_DATA_DIR
value: /var/lib/postgresql/data/pgdata/16
- name: INIT_CONTAINER
value: "true"
resources:
requests:
memory: "1Gi"
cpu: "1"
limits:
memory: "16Gi"
cpu: "8"
volumeMounts:
- name: postgres-pv-storage
mountPath: /var/lib/postgresql/data/pgdata
containers:
- name: s4dbs-postgres
image: docker.io/itgainis/s4dbs_timescaledb:2.1.1
ports:
- containerPort: 5432
imagePullPolicy: Always
env:
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: s4dbs-secrets
key: postgres-password
- name: POSTGRES_DB
value: speedgain
- name: OLD_DATA_DIR
value: /var/lib/postgresql/data/pgdata
- name: NEW_DATA_DIR
value: /var/lib/postgresql/data/pgdata/16
readinessProbe:
exec:
command: ["psql", "-w", "-U", "postgres", "-h", "localhost", "-d", "speedgain", "-c", "SELECT 1"]
failureThreshold: 60
periodSeconds: 10
livenessProbe:
exec:
command: ["psql", "-w", "-U", "postgres", "-h", "localhost", "-d", "speedgain", "-c", "SELECT 1"]
failureThreshold: 5
periodSeconds: 10
startupProbe:
exec:
command: ["psql", "-w", "-U", "postgres", "-h", "localhost", "-d", "speedgain", "-c", "SELECT 1"]
failureThreshold: 60
periodSeconds: 10
resources:
requests:
memory: "1Gi"
cpu: "1"
limits:
memory: "16Gi"
cpu: "8"
volumeMounts:
- name: postgres-pv-storage
mountPath: /var/lib/postgresql/data/pgdata
---
apiVersion: v1
kind: Service
metadata:
name: s4dbs-postgres-service
spec:
selector:
app: s4dbs-postgres
ports:
- protocol: TCP
port: 5432
targetPort: 5432
3.3.8. Speedgain Service deployment file s4dbs-service.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: s4dbs-service
name: s4dbs-service-deployment
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
app: s4dbs-service
template:
metadata:
labels:
app: s4dbs-service
spec:
containers:
- name: s4dbs-service
image: docker.io/itgainis/s4dbs_service:2.1.1
ports:
- containerPort: 8080
imagePullPolicy: Always
env:
- name: PDB_DB_NAME
value: speedgain
- name: PDB_HOST
# In some environments it may be necessary to fully qualify the service name: s4dbs-postgres-service.default.svc.cluster.local
# OpenVPN could be a cause of issues.
value: s4dbs-postgres-service
- name: PDB_PASS
valueFrom:
secretKeyRef:
name: s4dbs-secrets
key: postgres-password
- name: PDB_PORT
value: "5432"
- name: PDB_USER
value: postgres
- name: SPGDB_SERVICE_HOME
value: /opt/spgdb_service_home/
readinessProbe:
exec:
command: ["curl", "-f", "localhost:8080/Speedgain_for_Databases_Service"]
failureThreshold: 60
periodSeconds: 10
livenessProbe:
exec:
command: ["curl", "-f", "localhost:8080/Speedgain_for_Databases_Service"]
failureThreshold: 5
periodSeconds: 10
startupProbe:
exec:
command: ["curl", "-f", "localhost:8080/Speedgain_for_Databases_Service"]
failureThreshold: 60
periodSeconds: 10
resources:
requests:
memory: "256Mi"
cpu: "0.5"
limits:
memory: "4Gi"
cpu: "2"
restartPolicy: Always
---
apiVersion: v1
kind: Service
metadata:
name: s4dbs-service-service
spec:
selector:
app: s4dbs-service
ports:
- protocol: TCP
port: 8080
targetPort: 8080
3.3.9. Speedgain Grafana deployment file s4dbs-grafana.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: s4dbs-grafana
name: s4dbs-grafana-deployment
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
app: s4dbs-grafana
template:
metadata:
labels:
app: s4dbs-grafana
spec:
volumes:
- name: grafana-pv-storage
persistentVolumeClaim:
claimName: s4dbs-grafana-pv-claim
- name: grafana-dashboard-pv-storage
persistentVolumeClaim:
claimName: s4dbs-grafana-dashboards-pv-claim
containers:
- name: s4dbs-grafana
image: docker.io/itgainis/s4dbs_grafana:2.1.1
ports:
- containerPort: 3000
imagePullPolicy: Always
env:
- name: PDB_DB_NAME
value: speedgain
- name: PDB_HOST
value: s4dbs-postgres-service
- name: PDB_PASS
valueFrom:
secretKeyRef:
name: s4dbs-secrets
key: postgres-password
- name: PDB_PORT
value: "5432"
- name: PDB_USER
value: "postgres"
#- name: GF_DASHBOARDS_DEFAULT_HOME_DASHBOARD_PATH
# value: "/grafanaprovisioning/dashboards/s4dbs-spg/S4DBs-Overview.json"
- name: GF_SERVER_SERVE_FROM_SUB_PATH
value: "true"
- name: GF_SERVER_ROOT_URL
value: "%(protocol)s://%(domain)s:%(http_port)s/grafana/"
- name: GF_SERVER_DOMAIN
value: <enter host hostname here>
- name: GF_SECURITY_ALLOW_EMBEDDING
value: "true"
- name: GF_AUTH_ANONYMOUS_ENABLED
value: "true"
- name: GF_USERS_DEFAULT_THEME
value: "light"
- name: GF_PATHS_PLUGINS
value: "/grafanaplugins/"
- name: GF_PATHS_PROVISIONING
value: "/grafanaprovisioning/"
# Store repository data in PostgreSQL DB
- name: GF_DATABASE_TYPE
value: "postgres"
- name: GF_DATABASE_HOST
value: "s4dbs-postgres-service:5432"
- name: GF_DATABASE_NAME
value: "speedgain"
- name: GF_DATABASE_USER
value: postgres
- name: GF_DATABASE_PASSWORD
valueFrom:
secretKeyRef:
name: s4dbs-secrets
key: postgres-password
resources:
requests:
memory: "256Mi"
cpu: "0.5"
limits:
memory: "2Gi"
cpu: "2"
volumeMounts:
- name: grafana-pv-storage
mountPath: /var/lib/grafana
- name: grafana-dashboard-pv-storage
mountPath: /grafanaprovisioning/
readinessProbe:
tcpSocket:
port: 3000
failureThreshold: 60
periodSeconds: 10
livenessProbe:
tcpSocket:
port: 3000
failureThreshold: 5
periodSeconds: 10
startupProbe:
tcpSocket:
port: 3000
failureThreshold: 60
periodSeconds: 10
restartPolicy: Always
---
apiVersion: v1
kind: Service
metadata:
name: s4dbs-grafana-service
spec:
selector:
app: s4dbs-grafana
ports:
- protocol: TCP
port: 3000
targetPort: 3000
3.3.10. Speedgain Web Frontend deployment file s4dbs-frontend.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: s4dbs-frontend
name: s4dbs-frontend-deployment
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
app: s4dbs-frontend
template:
metadata:
labels:
app: s4dbs-frontend
spec:
containers:
- name: s4dbs-frontend
image: docker.io/itgainis/s4dbs_frontend:2.1.1
ports:
- containerPort: 8080
imagePullPolicy: Always
env:
- name: FRONTEND_CONFIG_MODE
value: "false"
- name: SERVICE_PROTOCOL
value: http
- name: SERVICE_HOST
value: <enter host hostname here>
- name: SERVICE_PORT
value: "30800"
- name: GRAFANA_PROTOCOL
value: http
- name: GRAFANA_HOST
value: <enter host hostname here>
- name: GRAFANA_PORT
value: "30800/grafana"
readinessProbe:
httpGet:
path: /s4dbs-ui
port: 8080
failureThreshold: 60
periodSeconds: 10
livenessProbe:
httpGet:
path: /s4dbs-ui
port: 8080
failureThreshold: 5
periodSeconds: 10
startupProbe:
httpGet:
path: /s4dbs-ui
port: 8080
failureThreshold: 60
periodSeconds: 10
resources:
requests:
memory: "128Mi"
cpu: "0.5"
limits:
memory: "2Gi"
cpu: "1"
restartPolicy: Always
---
apiVersion: v1
kind: Service
metadata:
name: s4dbs-frontend-service
spec:
selector:
app: s4dbs-frontend
ports:
- protocol: TCP
port: 8080
targetPort: 8080
3.3.11. Speedgain Reverse Proxy deployment file s4dbs-reverse.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: s4dbs-reverse
name: s4dbs-reverse-deployment
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
app: s4dbs-reverse
template:
metadata:
labels:
app: s4dbs-reverse
spec:
containers:
- name: s4dbs-reverse
image: docker.io/nginx:1.29.1-alpine
ports:
- containerPort: 80
imagePullPolicy: Always
volumeMounts:
- mountPath: /etc/nginx/nginx.conf
subPath: nginx.conf
name: s4dbs-nginx-conf
readOnly: true
readinessProbe:
httpGet:
path: /
port: 80
failureThreshold: 60
periodSeconds: 10
livenessProbe:
httpGet:
path: /
port: 80
failureThreshold: 5
periodSeconds: 10
startupProbe:
httpGet:
path: /
port: 80
failureThreshold: 60
periodSeconds: 10
resources:
requests:
memory: "256Mi"
cpu: "0.5"
limits:
memory: "2Gi"
cpu: "1"
restartPolicy: Always
volumes:
- name: s4dbs-nginx-conf
configMap:
name: s4dbs-nginx-conf
---
apiVersion: v1
kind: Service
metadata:
name: s4dbs-reverse-service
spec:
selector:
app: s4dbs-reverse
type: NodePort
ports:
- protocol: TCP
port: 80
targetPort: 80
nodePort: 30800
3.3.12. Kubernetes NginX configuration file nginx.conf
worker_processes 5; ## Default: 1
pid /tmp/nginx.pid;
events {
worker_connections 1000;
}
http {
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
upstream grafana {
server s4dbs-grafana-service:3000;
}
upstream service {
server s4dbs-service-service:8080;
}
server {
listen 80;
root /usr/share/nginx/www;
index index.html index.htm;
#SSL Config
# Enable the following 4 lines if SSL should be activated:
# listen 443 ssl http2;
# listen [::]:443 ssl http2;
# ssl_certificate_key /etc/ssl/ssl_cert.key;
# ssl_certificate /etc/ssl/ssl_cert.crt;
# service
location /Speedgain_for_Databases_Service/ {
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_pass http://service;
}
# frontend
location / {
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_pass http://s4dbs-frontend-service:8080/s4dbs-ui/;
}
location /s4dbs-ui/ {
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_pass http://s4dbs-frontend-service:8080/s4dbs-ui/;
}
# grafana
location /grafana/ {
proxy_set_header Host $http_host;
proxy_pass http://grafana;
proxy_read_timeout 300;
proxy_connect_timeout 300;
proxy_send_timeout 300;
}
location /grafana/api/live/ {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $http_host;
proxy_pass http://grafana;
proxy_read_timeout 300;
proxy_connect_timeout 300;
proxy_send_timeout 300;
}
}
}
3.3.13. Speedgain secrets configuration file s4dbs-secrets.yaml
apiVersion: v1 kind: Secret metadata: name: s4dbs-secrets type: Opaque stringData: postgres-password: <PasswordOfPostgresUser>