在 Kubernetes 中,如何创建 CronJob 来从标准 docker 镜像测试 mysql 数据库连接?

在 Kubernetes 中,如何创建 CronJob 来从标准 docker 镜像测试 mysql 数据库连接?

我正在尝试在 EKS 中创建一个 cronjob 来测试数据库连接,但它不起作用。我尝试使用 mysql-client docker 映像。这是 cronjob 定义:

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

但它又回来了:

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

任何想法?

相关内容