首页  >  问答  >  正文

Kubernetes中安装mysql-operator失败

因此,我按照指南(https://dev.mysql.com/doc/mysql-operator/en/mysql-operator-installation-kubectl.html)在 Kubernetes Ubuntu Server 22.04 集群上安装 MySql 集群。

我已成功运行以下命令来导入所需的 yaml 部署文件

kubectl apply -f https://raw.githubusercontent.com/mysql/mysql-operator/trunk/deploy/deploy-crds.yaml
kubectl apply -f https://raw.githubusercontent.com/mysql/mysql-operator/trunk/deploy/deploy-operator.yaml

现在,当我运行部署命令时,pod 会不断重新启动。

kubectl get deployment mysql-operator --namespace mysql-operator

这是日志的输出(我收到错误)

kubectl logs mysql-operator-755b988dd9-jn7f6 --namespace=mysql-operator
exec /usr/bin/mysqlsh: exec format error

这是描述:

kubectl describe pod mysql-operator-755b988dd9-jn7f6 --namespace=mysql-operator
Name:             mysql-operator-755b988dd9-jn7f6
Namespace:        mysql-operator
Priority:         0
Service Account:  mysql-operator-sa
Node:             mnetk8s-node-a1/10.30.0.11
Start Time:       Wed, 07 Jun 2023 22:52:40 +0100
Labels:           name=mysql-operator
                  pod-template-hash=755b988dd9
Annotations:      <none>
Status:           Running
IP:               10.244.3.6
IPs:
  IP:           10.244.3.6
Controlled By:  ReplicaSet/mysql-operator-755b988dd9
Containers:
  mysql-operator:
    Container ID:  docker://785da7db660ae71ad09e1d6ecf7672f68fbbfbf1e03b64b4619bde188c7a250f
    Image:         container-registry.oracle.com/mysql/community-operator:8.0.33-2.0.10
    Image ID:      docker-pullable://container-registry.oracle.com/mysql/community-operator@sha256:9c411c679b416b7d4bce4e14f65b311105429d25c3183f864fdd9baec8d5647f
    Port:          <none>
    Host Port:     <none>
    Args:
      mysqlsh
      --log-level=@INFO
      --pym
      mysqloperator
      operator
    State:          Waiting
      Reason:       CrashLoopBackOff
    Last State:     Terminated
      Reason:       Error
      Exit Code:    1
      Started:      Wed, 07 Jun 2023 23:34:29 +0100
      Finished:     Wed, 07 Jun 2023 23:34:29 +0100
    Ready:          False
    Restart Count:  13
    Readiness:      exec [cat /tmp/mysql-operator-ready] delay=1s timeout=1s period=3s #success=1 #failure=3
    Environment:
      MYSQLSH_USER_CONFIG_HOME:                 /mysqlsh
      MYSQLSH_CREDENTIAL_STORE_SAVE_PASSWORDS:  never
    Mounts:
      /mysqlsh from mysqlsh-home (rw)
      /tmp from tmpdir (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-jdn2d (ro)
Conditions:
  Type              Status
  Initialized       True
  Ready             False
  ContainersReady   False
  PodScheduled      True
Volumes:
  mysqlsh-home:
    Type:       EmptyDir (a temporary directory that shares a pod's lifetime)
    Medium:
    SizeLimit:  <unset>
  tmpdir:
    Type:       EmptyDir (a temporary directory that shares a pod's lifetime)
    Medium:
    SizeLimit:  <unset>
  kube-api-access-jdn2d:
    Type:                    Projected (a volume that contains injected data from multiple sources)
    TokenExpirationSeconds:  3607
    ConfigMapName:           kube-root-ca.crt
    ConfigMapOptional:       <nil>
    DownwardAPI:             true
QoS Class:                   BestEffort
Node-Selectors:              <none>
Tolerations:                 node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                             node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
  Type     Reason     Age                  From               Message
  ----     ------     ----                 ----               -------
  Normal   Scheduled  46m                  default-scheduler  Successfully assigned mysql-operator/mysql-operator-755b988dd9-jn7f6 to mnetk8s-node-a1
  Normal   Pulled     45m (x5 over 46m)    kubelet            Container image "container-registry.oracle.com/mysql/community-operator:8.0.33-2.0.10" already present on machine
  Normal   Created    45m (x5 over 46m)    kubelet            Created container mysql-operator
  Normal   Started    45m (x5 over 46m)    kubelet            Started container mysql-operator
  Warning  BackOff    97s (x221 over 46m)  kubelet            Back-off restarting failed container mysql-operator in pod mysql-operator-755b988dd9-jn7f6_mysql-operator(9e7f8c17-4fdd-4f98-a074-d2112019b28e)

任何帮助或想法都会很棒!

P粉951914381P粉951914381203 天前415

全部回复(2)我来回复

  • P粉842215006

    P粉8422150062024-03-30 17:58:42

    你可以看看这个。

    一个名为 kubeblocks 的开源工具,用于在 Kubernetes 上部署和管理 MySQL。

    我认为它可以解决您的问题。

    回复
    0
  • P粉176980522

    P粉1769805222024-03-30 12:12:08

    exec format error 通常意味着您正在使用的映像不适合您正在部署的架构。也就是说,您在 AMD64 节点上使用 ARM 映像,反之亦然。

    由于 Oracle 容器注册表上的所有 MySQL 映像都是 AMD64 映像,因此我猜测您的集群正在 ARM 架构上运行,例如 Ampere 实例。

    您将需要在 x64 arch 实例上运行,或者找到 ARM 的映像,或者转到源代码并重建 ARM 的映像。

    回复
    0
  • 取消回复