Add healthcheck to proxysql
This commit is contained in:
parent
3e2bb251ee
commit
072f762a0d
|
@ -406,3 +406,10 @@ data:
|
||||||
{ hostname = "proxysql-1.proxysqlcluster", port = 6032, weight = 1 },
|
{ hostname = "proxysql-1.proxysqlcluster", port = 6032, weight = 1 },
|
||||||
{ hostname = "proxysql-2.proxysqlcluster", port = 6032, weight = 1 }
|
{ hostname = "proxysql-2.proxysqlcluster", port = 6032, weight = 1 }
|
||||||
)
|
)
|
||||||
|
healthcheck.sh: |
|
||||||
|
#!/bin/bash
|
||||||
|
num_servers=$(mysql -NB -u admin -h 127.0.0.1 -P 6032 -e "select count(*) from main.mysql_servers")
|
||||||
|
if [[ ${num_servers} -lt 1 ]]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
exit 0
|
||||||
|
|
|
@ -50,11 +50,27 @@ spec:
|
||||||
- name: proxysql-etc
|
- name: proxysql-etc
|
||||||
mountPath: /etc
|
mountPath: /etc
|
||||||
subPath: etc
|
subPath: etc
|
||||||
|
- name: proxysql-healthcheck
|
||||||
|
mountPath: /usr/local/bin/healthcheck.sh
|
||||||
|
subPath: healthcheck.sh
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 6033
|
- containerPort: 6033
|
||||||
name: proxysql-mysql
|
name: proxysql-mysql
|
||||||
- containerPort: 6032
|
- containerPort: 6032
|
||||||
name: proxysql-admin
|
name: proxysql-admin
|
||||||
|
env:
|
||||||
|
- name: MYSQL_PWD
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: proxysql-secret
|
||||||
|
key: "proxysql_admin_password"
|
||||||
|
livenessProbe:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- /bin/bash
|
||||||
|
- /usr/local/bin/healthcheck.sh
|
||||||
|
initialDelaySeconds: 5
|
||||||
|
periodSeconds: 5
|
||||||
initContainers:
|
initContainers:
|
||||||
- image: docker.sunet.se/sunet/docker-jinja:latest
|
- image: docker.sunet.se/sunet/docker-jinja:latest
|
||||||
name: init-config
|
name: init-config
|
||||||
|
@ -309,3 +325,9 @@ spec:
|
||||||
items:
|
items:
|
||||||
- key: "proxysql.cnf"
|
- key: "proxysql.cnf"
|
||||||
path: "proxysql.cnf"
|
path: "proxysql.cnf"
|
||||||
|
- name: proxysql-healthcheck
|
||||||
|
configMap:
|
||||||
|
name: proxysql-configmap
|
||||||
|
items:
|
||||||
|
- key: "healthcheck.sh"
|
||||||
|
path: "healthcheck.sh"
|
||||||
|
|
Loading…
Reference in a new issue