3.1 使用 Helm 部署

此处可见创建 MySQL InnoDB 集群的潜在价值:

Press CTRL+C to copy
$> helm show values mysql-operator/mysql-innodbcluster

公共登记处

最常见的 Helm 存储库是公共 https://artifacthub.io/,这些示例使用了它。

此示例使用默认命名空间中的所有默认值,并将 mycluster 作为发布名称:

Press CTRL+C to copy
$> helm install mycluster mysql-operator/mysql-innodbcluster

这个简单安装的清单类似于:

Press CTRL+C to copy
$> helm get manifest mycluster --- # Source: mysql-innodbcluster/templates/service_account_cluster.yaml apiVersion: v1 kind: ServiceAccount metadata: name: mycluster-sa namespace: default --- # Source: mysql-innodbcluster/templates/cluster_secret.yaml apiVersion: v1 kind: Secret metadata: name: mycluster-cluster-secret namespace: default stringData: rootUser: root rootHost: "%" rootPassword: sakila --- # Source: mysql-innodbcluster/templates/deployment_cluster.yaml apiVersion: mysql.oracle.com/v2 kind: InnoDBCluster metadata: name: mycluster namespace: default spec: instances: 3 router: instances: 1 secretName: mycluster-cluster-secret imagePullPolicy : IfNotPresent baseServerId: 1000 version: 8.0.31 serviceAccountName: mycluster-sa tls: useSelfSigned: false

或者使用命令行参数设置选项:

Press CTRL+C to copy
$> helm install mycluster mysql-operator/mysql-innodbcluster \ --set credentials.root.user='root' \ --set credentials.root.password='sakila' \ --set credentials.root.host='%' \ --set serverInstances=3 \ --set routerInstances=1 \ --set tls.useSelfSigned=true

查看用户为现有集群提供的值:

Press CTRL+C to copy
$> helm get values mycluster USER-SUPPLIED VALUES: credentials: root: host: '%' password: sakila user: root routerInstances: 1 serverInstances: 3 tls: useSelfSigned: true

另见第 4 章,连接到 MySQL InnoDB 集群