在Kubernetes上安装mysql-operator失败。

huangapple go评论107阅读模式
英文:

Installing mysql-operator on kubernetes is failing

问题

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

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

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

现在当我运行部署命令时,Pod 一直在重新启动。

  1. kubectl get deployment mysql-operator --namespace mysql-operator

以下是日志的输出(我收到一个错误)

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

这是描述:

  1. kubectl describe pod mysql-operator-755b988dd9-jn7f6 --namespace=mysql-operator
  2. Name: mysql-operator-755b988dd9-jn7f6
  3. Namespace: mysql-operator
  4. Priority: 0
  5. Service Account: mysql-operator-sa
  6. Node: mnetk8s-node-a1/10.30.0.11
  7. Start Time: Wed, 07 Jun 2023 22:52:40 +0100
  8. ...

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

英文:

So I am following the guide (https://dev.mysql.com/doc/mysql-operator/en/mysql-operator-installation-kubectl.html) to install MySql cluster on a Kubernetes Ubuntu Server 22.04 cluster.

I have run the following commands successfully to import the required yaml deployment files

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

Now when I then run the deployment command, the pod keeps restarting.

  1. kubectl get deployment mysql-operator --namespace mysql-operator

Here is the output of the logs (I receive an error)

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

And here is the describe:

  1. kubectl describe pod mysql-operator-755b988dd9-jn7f6 --namespace=mysql-operator
  2. Name: mysql-operator-755b988dd9-jn7f6
  3. Namespace: mysql-operator
  4. Priority: 0
  5. Service Account: mysql-operator-sa
  6. Node: mnetk8s-node-a1/10.30.0.11
  7. Start Time: Wed, 07 Jun 2023 22:52:40 +0100
  8. Labels: name=mysql-operator
  9. pod-template-hash=755b988dd9
  10. Annotations: <none>
  11. Status: Running
  12. IP: 10.244.3.6
  13. IPs:
  14. IP: 10.244.3.6
  15. Controlled By: ReplicaSet/mysql-operator-755b988dd9
  16. Containers:
  17. mysql-operator:
  18. Container ID: docker://785da7db660ae71ad09e1d6ecf7672f68fbbfbf1e03b64b4619bde188c7a250f
  19. Image: container-registry.oracle.com/mysql/community-operator:8.0.33-2.0.10
  20. Image ID: docker-pullable://container-registry.oracle.com/mysql/community-operator@sha256:9c411c679b416b7d4bce4e14f65b311105429d25c3183f864fdd9baec8d5647f
  21. Port: <none>
  22. Host Port: <none>
  23. Args:
  24. mysqlsh
  25. --log-level=@INFO
  26. --pym
  27. mysqloperator
  28. operator
  29. State: Waiting
  30. Reason: CrashLoopBackOff
  31. Last State: Terminated
  32. Reason: Error
  33. Exit Code: 1
  34. Started: Wed, 07 Jun 2023 23:34:29 +0100
  35. Finished: Wed, 07 Jun 2023 23:34:29 +0100
  36. Ready: False
  37. Restart Count: 13
  38. Readiness: exec [cat /tmp/mysql-operator-ready] delay=1s timeout=1s period=3s #success=1 #failure=3
  39. Environment:
  40. MYSQLSH_USER_CONFIG_HOME: /mysqlsh
  41. MYSQLSH_CREDENTIAL_STORE_SAVE_PASSWORDS: never
  42. Mounts:
  43. /mysqlsh from mysqlsh-home (rw)
  44. /tmp from tmpdir (rw)
  45. /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-jdn2d (ro)
  46. Conditions:
  47. Type Status
  48. Initialized True
  49. Ready False
  50. ContainersReady False
  51. PodScheduled True
  52. Volumes:
  53. mysqlsh-home:
  54. Type: EmptyDir (a temporary directory that shares a pod's lifetime)
  55. Medium:
  56. SizeLimit: <unset>
  57. tmpdir:
  58. Type: EmptyDir (a temporary directory that shares a pod's lifetime)
  59. Medium:
  60. SizeLimit: <unset>
  61. kube-api-access-jdn2d:
  62. Type: Projected (a volume that contains injected data from multiple sources)
  63. TokenExpirationSeconds: 3607
  64. ConfigMapName: kube-root-ca.crt
  65. ConfigMapOptional: <nil>
  66. DownwardAPI: true
  67. QoS Class: BestEffort
  68. Node-Selectors: <none>
  69. Tolerations: node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
  70. node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
  71. Events:
  72. Type Reason Age From Message
  73. ---- ------ ---- ---- -------
  74. Normal Scheduled 46m default-scheduler Successfully assigned mysql-operator/mysql-operator-755b988dd9-jn7f6 to mnetk8s-node-a1
  75. 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
  76. Normal Created 45m (x5 over 46m) kubelet Created container mysql-operator
  77. Normal Started 45m (x5 over 46m) kubelet Started container mysql-operator
  78. 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)

Any help or ideas would be amazing!

答案1

得分: 1

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

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

您需要在x64架构实例上运行,或者找到一个适用于ARM的映像,或者转向源代码并重新构建适用于ARM的映像。

英文:

exec format error usually means the image you are using are not for the architecture you are deploying on. That is, you are using an ARM image on a AMD64 node or vice versa.

Since all of the MySQL images on oracle container registry are AMD64 images, my guess is that your cluster is running on an ARM arch, like an Ampere instance.

You're going to need to run on an x64 arch instance, or find an image for ARM, or go to the source and rebuild the image for ARM.

答案2

得分: -1

你可以查看这个。

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

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

英文:

You can check this out.

An open-source tool called kubeblocks for deploying and managing MySQL on Kubernetes.

I think it can solve your problem.

huangapple
  • 本文由 发表于 2023年6月8日 06:41:29
  • 转载请务必保留本文链接:https://go.coder-hub.com/76427516.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定