FAiled to intialized PXC in kubernetes

root@cladev-dd03-mg:~# kubectl describe pod cluster1-pxc-1 -n perconamysql
Name:             cluster1-pxc-1
Namespace:        perconamysql
Priority:         0
Service Account:  default
Node:             <none>
Labels:           app.kubernetes.io/component=pxc
                  app.kubernetes.io/instance=cluster1
                  app.kubernetes.io/managed-by=percona-xtradb-cluster-operator
                  app.kubernetes.io/name=percona-xtradb-cluster
                  app.kubernetes.io/part-of=percona-xtradb-cluster
                  apps.kubernetes.io/pod-index=1
                  controller-revision-hash=cluster1-pxc-66b8dc59cc
                  statefulset.kubernetes.io/pod-name=cluster1-pxc-1
Annotations:      percona.com/configuration-hash: d41d8cd98f00b204e9800998ecf8427e
                  percona.com/ssl-hash: 66334971f554dd36edb2c375401ed6fb
                  percona.com/ssl-internal-hash: c7ecd8f7844738343473f92dfe94d4ae
Status:           Pending
IP:
IPs:              <none>
Controlled By:    StatefulSet/cluster1-pxc
Init Containers:
  pxc-init:
    Image:      percona/percona-xtradb-cluster-operator:1.15.1
    Port:       <none>
    Host Port:  <none>
    Command:
      /pxc-init-entrypoint.sh
    Limits:
      cpu:     50m
      memory:  50M
    Requests:
      cpu:        50m
      memory:     50M
    Environment:  <none>
    Mounts:
      /var/lib/mysql from datadir (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-2tknk (ro)
Containers:
  logs:
    Image:      percona/percona-xtradb-cluster-operator:1.15.1-logcollector-fluentbit3.1.4
    Port:       <none>
    Host Port:  <none>
    Requests:
      cpu:     200m
      memory:  100M
    Environment Variables from:
      cluster1-log-collector  Secret  Optional: true
    Environment:
      LOG_DATA_DIR:   /var/lib/mysql
      POD_NAMESPASE:  perconamysql (v1:metadata.namespace)
      POD_NAME:       cluster1-pxc-1 (v1:metadata.name)
    Mounts:
      /var/lib/mysql from datadir (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-2tknk (ro)
  logrotate:
    Image:      percona/percona-xtradb-cluster-operator:1.15.1-logcollector-fluentbit3.1.4
    Port:       <none>
    Host Port:  <none>
    Args:
      logrotate
    Requests:
      cpu:     200m
      memory:  100M
    Environment:
      SERVICE_TYPE:      mysql
      MONITOR_PASSWORD:  <set to the key 'monitor' in secret 'internal-cluster1'>  Optional: false
    Mounts:
      /var/lib/mysql from datadir (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-2tknk (ro)
  pxc:
    Image:       percona/percona-xtradb-cluster:8.0.36-28.1
    Ports:       3306/TCP, 4444/TCP, 4567/TCP, 4568/TCP, 33062/TCP, 33060/TCP
    Host Ports:  0/TCP, 0/TCP, 0/TCP, 0/TCP, 0/TCP, 0/TCP
    Command:
      /var/lib/mysql/pxc-entrypoint.sh
    Args:
      mysqld
    Requests:
      cpu:      600m
      memory:   1G
    Liveness:   exec [/var/lib/mysql/liveness-check.sh] delay=300s timeout=5s period=10s #success=1 #failure=3
    Readiness:  exec [/var/lib/mysql/readiness-check.sh] delay=15s timeout=15s period=30s #success=1 #failure=5
    Environment Variables from:
      cluster1-env-vars-pxc  Secret  Optional: true
    Environment:
      PXC_SERVICE:                    cluster1-pxc-unready
      MONITOR_HOST:                   %
      MYSQL_ROOT_PASSWORD:            <set to the key 'root' in secret 'internal-cluster1'>        Optional: false
      XTRABACKUP_PASSWORD:            <set to the key 'xtrabackup' in secret 'internal-cluster1'>  Optional: false
      MONITOR_PASSWORD:               <set to the key 'monitor' in secret 'internal-cluster1'>     Optional: false
      LOG_DATA_DIR:                   /var/lib/mysql
      IS_LOGCOLLECTOR:                yes
      CLUSTER_HASH:                   1680264
      OPERATOR_ADMIN_PASSWORD:        <set to the key 'operator' in secret 'internal-cluster1'>  Optional: false
      LIVENESS_CHECK_TIMEOUT:         5
      READINESS_CHECK_TIMEOUT:        15
      DEFAULT_AUTHENTICATION_PLUGIN:  caching_sha2_password
    Mounts:
      /etc/my.cnf.d from auto-config (rw)
      /etc/mysql/init-file from mysql-init-file (rw)
      /etc/mysql/mysql-users-secret from mysql-users-secret-file (rw)
      /etc/mysql/ssl from ssl (rw)
      /etc/mysql/ssl-internal from ssl-internal (rw)
      /etc/mysql/vault-keyring-secret from vault-keyring-secret (rw)
      /etc/percona-xtradb-cluster.conf.d from config (rw)
      /tmp from tmp (rw)
      /var/lib/mysql from datadir (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-2tknk (ro)
Conditions:
  Type           Status
  PodScheduled   False
Volumes:
  datadir:
    Type:       PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
    ClaimName:  datadir-cluster1-pxc-1
    ReadOnly:   false
  tmp:
    Type:       EmptyDir (a temporary directory that shares a pod's lifetime)
    Medium:
    SizeLimit:  <unset>
  config:
    Type:      ConfigMap (a volume populated by a ConfigMap)
    Name:      cluster1-pxc
    Optional:  true
  ssl-internal:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  cluster1-ssl-internal
    Optional:    true
  ssl:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  cluster1-ssl
    Optional:    false
  auto-config:
    Type:      ConfigMap (a volume populated by a ConfigMap)
    Name:      auto-cluster1-pxc
    Optional:  true
  vault-keyring-secret:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  cluster1-vault
    Optional:    true
  mysql-users-secret-file:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  internal-cluster1
    Optional:    false
  mysql-init-file:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  cluster1-mysql-init
    Optional:    true
  kube-api-access-2tknk:
    Type:                    Projected (a volume that contains injected data from multiple sources)
    TokenExpirationSeconds:  3607
    ConfigMapName:           kube-root-ca.crt
    ConfigMapOptional:       <nil>
    DownwardAPI:             true
QoS Class:                   Burstable
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
  ----     ------            ----                    ----               -------
  Warning  FailedScheduling  3m14s (x605 over 2d2h)  default-scheduler  0/1 nodes are available: 1 node(s) didn't match pod anti-affinity rules. preemption: 0/1 nodes are available: 1 No preemption victims found for incoming pod.
root@cladev-dd03-mg:~# kubectl get pods -n perconamysql
NAME                                              READY   STATUS    RESTARTS        AGE
cluster1-haproxy-0                                2/2     Running   7 (2d2h ago)    2d3h
cluster1-haproxy-1                                0/2     Pending   0               2d2h
cluster1-pxc-0                                    3/3     Running   5 (2d2h ago)    2d3h
cluster1-pxc-1                                    0/3     Pending   0               2d3h
percona-xtradb-cluster-operator-58874cfbb-fsdwj   1/1     Running   15 (2d2h ago)   2d3h
root@cladev-dd03-mg:~#

I am unable to install Percona cluster on kubernetes

This steps were followed :

Hi @Jyoti_Rajai,

By default PXC operator needs to have at least 3 worker nodes. Looks like you only have 1 node. You can set antiAffinityTopologyKey to none to run all pods in the same node.

In which file should I change it

In cr.yaml: percona-xtradb-cluster-operator/deploy/cr.yaml at v1.15.1 · percona/percona-xtradb-cluster-operator · GitHub