I'm trying to create a cronjob in EKS to test the database connection, but it's no working. I tried with the mysql-client docker image. This is the cronjob definition:
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: mysql-test
namespace: default
spec:
schedule: "*/5 * * * *"
jobTemplate:
spec:
template:
spec:
containers:
- name: mysql
image: imega/mysql-client
command: ["mysql", "-xxxxxxx.us-east-1.rds.amazonaws.com", "-uxxxxxxx", "-pxxxxxxx", "-e'show databases;'"]
restartPolicy: Never
But it's returning:
ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '`show databases;`' at line 1
Any idea?