Why my pods show 5/5? Need some understanding about K8s Pods for Crunchy Data

235 views Asked by At

I have a Postgres crunchy operator high availability cluster running on a k8s cluster with one master and 3 work nodes. I am using rook-ceph storage by default. This is my deployment yaml file for HA-Cluster.

apiVersion: postgres-operator.crunchydata.com/v1beta1
kind: PostgresCluster
metadata:
  name: hippo-ha
spec:
  service:
    type: LoadBalancer
  patroni:
    dynamicConfiguration:
      synchronous_mode: true
      postgresql:
        parameters:
          synchronous_commit: "on"
  image: registry.developers.crunchydata.com/crunchydata/crunchy-postgres:ubi8-14.6-2
  postgresVersion: 14
  instances:
    - name: pgha1
      replicas: 2
      dataVolumeClaimSpec:
        accessModes:
        - "ReadWriteOnce"
        resources:
          requests:
            storage: 1Gi
      affinity:
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
          - weight: 1
            podAffinityTerm:
              topologyKey: kubernetes.io/hostname
              labelSelector:
                matchLabels:
                  postgres-operator.crunchydata.com/cluster: hippo-ha
                  postgres-operator.crunchydata.com/instance-set: pgha1
  
  monitoring:
    pgmonitor:
      exporter:
       image: registry.developers.crunchydata.com/crunchydata/crunchy-postgres-exporter:ubi8-5.3.0-0
  backups:
    pgbackrest:
      #manual:
        #repoName: repo1
        #options:
         #- --type=full
      image: registry.developers.crunchydata.com/crunchydata/crunchy-pgbackrest:ubi8-2.41-2
      repos:
      - name: repo1
        volume:
          volumeClaimSpec:
            accessModes:
            - "ReadWriteOnce"
            resources:
              requests:
                storage: 1Gi
  proxy:
    pgBouncer:
      image: registry.developers.crunchydata.com/crunchydata/crunchy-pgbouncer:ubi8-1.17-5
      replicas: 2
      affinity:
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
          - weight: 1
            podAffinityTerm:
              topologyKey: kubernetes.io/hostname
              labelSelector:
                matchLabels:
                  postgres-operator.crunchydata.com/cluster: hippo-ha
                  postgres-operator.crunchydata.com/role: pgbouncer
      resources:
        limits:
          cpu: "500m"
          memory: "512Mi"
        requests:
          cpu: "250m"
          memory: "256Mi"

Output: This deploys the cluster successfully and I can see one Primary pod, one Replica and one Backup-repo pod.

 masterk8s@virtual-machine:~/postgres-operator-examples-3$ kubectl get pods -n postgres-operator
NAME                                    READY   STATUS    RESTARTS       AGE
crunchy-alertmanager-5cd75b4f75-trqjp   1/1     Running   0              47h
crunchy-grafana-64b9f9dcc-nwpk6         1/1     Running   2 (47h ago)    47h
crunchy-prometheus-dc4cbff87-5n8th      1/1     Running   0              47h
hippo-ha-pgbouncer-6b989c8ddd-kfrx8     2/2     Running   0              47h
hippo-ha-pgbouncer-6b989c8ddd-lmt9w     2/2     Running   0              47h
hippo-ha-pgha1-58wc-0                   5/5     Running   1 (35h ago)    47h
hippo-ha-pgha1-ths4-0                   5/5     Running   20 (14h ago)   47h
hippo-ha-repo-host-0                    2/2     Running   1 (47h ago)    47h
pgo-7c867985c-gf4xj                     1/1     Running   2 (8d ago)     9d
pgo-upgrade-69b5dfdc45-qxnkb            1/1     Running   2 (8d ago)     9d

What DO I want to know?

If we can see pods of hippo-ha-pgha1-58wc-0 or replica hippo-ha-pgha1-ths4-0 it shows READY 5/5. I didn't manage to understand why 5. I have one cluster with 2 replica sets and I only can see 2 pods. So what is 5/5?

I want some explanation about it as Documentation didn't help much and neither I found any proper explanation on google. It will be a great help and I really appreciate your time.

I even install the k8s dashboard and also check all the resources and I only found 2 pods and yet it shows 5 out of 5 pods running. Regards,

1

There are 1 answers

2
Blender Fox On

The number "5/5" indicates the pod contains 5 containers, and 5 of them are running.

A pod can contain one or more containers which run as a unit and can contain 1 or more init containers which run to completion before the main containers run.

When a deployment or replicaset says "pods" they are referring to that unit of 1 or more containers.

So a deployment of 2 pods for "hippo-ha-pgha1" actually means "two pods of 5 containers each"