Kubernetes:如何运行MySQL命令?

时间:2019-01-04 07:50:33

标签: mysql docker kubernetes devops

在Docker中,我可以使用BuilderImpl1文件中的command: --default-authentication-plugin=mysql_native_password。在创建MySQL部署时如何通过此操作?

我正在使用MySQL8

1 个答案:

答案 0 :(得分:3)

它看起来像这样:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: mysql-deployment
  labels:
    app: mysql
spec:
  replicas: 1
  selector:
    matchLabels:
      app: mysql
  template:
    metadata:
      labels:
        app: mysql
    spec:
      containers:
      - name: mysql
        image: mysql:8
        env:
        - name: MYSQL_ROOT_PASSWORD
          value: XXXXXXXXXXXXXXXX
        args: ["--default-authentication-plugin=mysql_native_password"]
        ports:
        - containerPort: 3306