Kubernetes 的 MySQL Operator 版本資訊
MySQL Shell
MySQL Router
本文件假設您熟悉 kubectl,並且已安裝它。或者,請參閱第 2.1 節,「使用 Helm Charts 安裝」。
可以使用原始 manifest 檔案和 kubectl 安裝 Kubernetes 的 MySQL Operator。
注意
URL 中的 trunk
參照 Kubernetes 的 MySQL Operator 的最新版本,因為 Github 會在發佈時更新。或者,將 URL 中的 trunk
替換為特定的標記版本。
首先安裝 Kubernetes 的 MySQL Operator 使用的自訂資源定義 (CRD)
$> kubectl apply -f https://raw.githubusercontent.com/mysql/mysql-operator/trunk/deploy/deploy-crds.yaml
// Output is similar to:
customresourcedefinition.apiextensions.k8s.io/innodbclusters.mysql.oracle.com created
customresourcedefinition.apiextensions.k8s.io/mysqlbackups.mysql.oracle.com created
customresourcedefinition.apiextensions.k8s.io/clusterkopfpeerings.zalando.org created
customresourcedefinition.apiextensions.k8s.io/kopfpeerings.zalando.org created
接下來部署 Kubernetes 的 MySQL Operator,其中也包含輸出中指出的 RBAC 定義
$> kubectl apply -f https://raw.githubusercontent.com/mysql/mysql-operator/trunk/deploy/deploy-operator.yaml
// Output is similar to:
clusterrole.rbac.authorization.k8s.io/mysql-operator created
clusterrole.rbac.authorization.k8s.io/mysql-sidecar created
clusterrolebinding.rbac.authorization.k8s.io/mysql-operator-rolebinding created
clusterkopfpeering.zalando.org/mysql-operator created
namespace/mysql-operator created
serviceaccount/mysql-operator-sa created
deployment.apps/mysql-operator created
透過檢查管理 mysql-operator 命名空間內 operator 的部署來驗證 operator 是否正在執行,這是由 deploy-operator.yaml
定義的可設定命名空間
$> kubectl get deployment mysql-operator --namespace mysql-operator
當 Kubernetes 的 MySQL Operator 準備就緒後,輸出應類似如下
NAME READY UP-TO-DATE AVAILABLE AGE
mysql-operator 1/1 1 1 37s
若要使用 Kubernetes 的 MySQL Operator 建立 MySQL InnoDB Cluster,請參閱第 3 章,「MySQL InnoDB Cluster」。