1

我已经使用 1.3.0 运算符在 kubernetes 上安装了 Percona XtraDB。

使用后,我想删除命名空间。所以我按照我应用它们的顺序删除了它们。一切都被删除了,在 svc、pod 中什么都看不到,但是有两个资源处于错误状态并且无法删除。

~ kubectl get perconaxtradbclusters -n pxc
NAME       ENDPOINT   STATUS   PXC   PROXYSQL   AGE
cluster1              Error    0     0          4h1m
cluster2              Error    0     0          3h34m

我无法删除它们,因此我无法创建具有相同名称的集群。

当我运行删除命令时,它会永远卡住

~ kubectl delete  perconaxtradbclusters -n pxc cluster1
perconaxtradbcluster.pxc.percona.com "cluster1" deleted

命令执行永远不会完成。

对象的yaml

apiVersion: pxc.percona.com/v1
kind: PerconaXtraDBCluster
metadata:
  annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"pxc.percona.com/v1-3-0","kind":"PerconaXtraDBCluster"}
  creationTimestamp: "2020-04-21T18:06:13Z"
  deletionGracePeriodSeconds: 0
  deletionTimestamp: "2020-04-21T18:38:33Z"
  finalizers:
  - delete-pxc-pods-in-order
  generation: 2
  name: cluster2
  namespace: pxc
  resourceVersion: "5445879"
  selfLink: /apis/pxc.percona.com/v1/namespaces/pxc/perconaxtradbclusters/cluster2
  uid: 8c100840-b7a8-40d1-b976-1f80c469622b
spec:
  allowUnsafeConfigurations: false
  backup:
    image: percona/percona-xtradb-cluster-operator:1.3.0-backup
    schedule:
    - keep: 3
      name: sat-night-backup
      schedule: 0 0 * * 6
      storageName: s3-us-west
    - keep: 5
      name: daily-backup
      schedule: 0 0 * * *
      storageName: fs-pvc
    serviceAccountName: percona-xtradb-cluster-operator
    storages:
      fs-pvc:
        type: filesystem
        volume:
          persistentVolumeClaim:
            accessModes:
            - ReadWriteOnce
            resources:
              requests:
                storage: 6Gi
      s3-us-west:
        s3:
          bucket: S3-BACKUP-BUCKET-NAME-HERE
          credentialsSecret: my-cluster-name-backup-s3
          region: us-west-2
        type: s3
  pmm:
    enabled: false
    image: percona/percona-xtradb-cluster-operator:1.3.0-pmm
    serverHost: monitoring-service
    serverUser: pmm
  proxysql:
    affinity:
      antiAffinityTopologyKey: kubernetes.io/hostname
    enabled: true
    gracePeriod: 30
    image: percona/percona-xtradb-cluster-operator:1.3.0-proxysql
    podDisruptionBudget:
      maxUnavailable: 1
    resources:
      requests:
        cpu: 600m
        memory: 1G
    size: 3
    volumeSpec:
      persistentVolumeClaim:
        resources:
          requests:
            storage: 2Gi
  pxc:
    affinity:
      antiAffinityTopologyKey: kubernetes.io/hostname
    gracePeriod: 600
    image: percona/percona-xtradb-cluster-operator:1.3.0-pxc
    podDisruptionBudget:
      maxUnavailable: 1
    resources:
      requests:
        cpu: 600m
        memory: 4G
    size: 3
    volumeSpec:
      persistentVolumeClaim:
        accessModes:
        - ReadWriteOnce
        resources:
          requests:
            storage: 60Gi
        storageClassName: local-storage
  secretsName: my-cluster-secrets
  sslInternalSecretName: my-cluster-ssl-internal
  sslSecretName: my-cluster-ssl
status:
  conditions:
  - lastTransitionTime: "2020-04-21T18:06:13Z"
    message: 'wrong PXC options: set version: new version: Malformed version: '
    reason: ErrorReconcile
    status: "True"            
    type: Error
  message:
  - 'Error: wrong PXC options: set version: new version: Malformed version: '
  proxysql:
    ready: 0
  pxc:
    ready: 0
  state: Error

我怎样才能摆脱它们

4

1 回答 1

4

您的perconaxtradbclustersyaml 示例提到了 pvc 资源,因此您可能必须先删除关联的 pvc,如果您还没有这样做的话。

您可以编辑资源以删除终结器块,然后再次尝试删除它们吗?

kubectl edit perconaxtradbclusters cluster1 -n pxc

并删除

finalizers: 
- delete-pxc-pods-in-order

如果没有任何东西可以依赖这些资源,那就是。

编辑:

如果我已经用尽所有其他可能性并且找不到阻止删除的挂起资源,我通常只会使用此方法。我做了一些挖掘。此处的此评论 描述了在移除终结器之前要采取的其他步骤。- 检查 API 服务是否可用 - 查找任何仍然存在的挥之不去的资源并将其删除。

于 2020-04-21T22:28:16.983 回答