Percona server for mongodb with kubernetes can be built with only replicasets

Hi Team,

I tried using the Install Percona server for MongoDB on Kubernetes manual to setup a 3 node mongodb replica set. I could see the configurations percona-server-mongodb-operator/cr.yaml at main · percona/percona-server-mongodb-operator · GitHub given is for building a sharded cluster. We tried editing the same and create it as only replicaset by removing all the shardserver, configserver, mognos configurations. but still we couldnt get the replicaset up and running.

the error i am facing is as below:

{“t”:{“$date”:“2021-06-16T06:33:40.695+00:00”},“s”:“I”, “c”:“REPL_HB”, “id”:23974, “ctx”:“ReplCoord-8”,“msg”:“Heartbeat failed after max retries”,“attr”:{“target”:“52.151.202.178:27017”,“maxHeartbeatRetries”:2,“error”:{“code”:93,“codeName”:“InvalidReplicaSetConfig”,“errmsg”:“replica set IDs do not match, ours: 60c993be2e1c25eed7abf7e3; remote node’s: 60c99455cdf76151698d3a66”}}}
{“t”:{“$date”:“2021-06-16T06:33:40.695+00:00”},“s”:“I”, “c”:“REPL_HB”, “id”:23974, “ctx”:“ReplCoord-13”,“msg”:“Heartbeat failed after max retries”,“attr”:{“target”:“52.151.202.178:27017”,“maxHeartbeatRetries”:2,“error”:{“code”:93,“codeName”:“InvalidReplicaSetConfig”,“errmsg”:“replica set IDs do not match, ours: 60c993be2e1c25eed7abf7e3; remote node’s: 60c99455cdf76151698d3a66”}}}

When i get into primary, it doesnt have the other members added in it.

Can some one help me with a sample crd.yaml defintion to spin up a three node replica set.

Thanks

1 Like

Hi @kajamuyenudeen

Here is a minimal CR:

apiVersion: psmdb.percona.com/v1-8-0
kind: PerconaServerMongoDB
metadata:
  name: my-cluster-name
spec:
  crVersion: 1.8.0
  image: percona/percona-server-mongodb:4.4.5-7
  imagePullPolicy: Always
  allowUnsafeConfigurations: false
  updateStrategy: SmartUpdate
  secrets:
    users: my-cluster-name-secrets
  pmm:
    enabled: false
    image: percona/pmm-client:2.12.0
    serverHost: monitoring-service
  replsets:
  - name: rs0
    size: 3
    affinity:
      antiAffinityTopologyKey: "kubernetes.io/hostname"
    podDisruptionBudget:
      maxUnavailable: 1
    expose:
      enabled: false
    arbiter:
      enabled: false
    resources:
      limits:
        cpu: "300m"
        memory: "0.5G"
      requests:
        cpu: "300m"
        memory: "0.5G"
    volumeSpec:
      persistentVolumeClaim:
        resources:
          requests:
            storage: 3Gi
  sharding:
    enabled: false
  mongod:
    net:
      port: 27017
      hostPort: 0
    security:
      redactClientLogData: false
      enableEncryption: true
      encryptionKeySecret: my-cluster-name-mongodb-encryption-key
      encryptionCipherMode: AES256-CBC
    setParameter:
      ttlMonitorSleepSecs: 60
      wiredTigerConcurrentReadTransactions: 128
      wiredTigerConcurrentWriteTransactions: 128
    storage:
      engine: wiredTiger
      inMemory:
        engineConfig:
          inMemorySizeRatio: 0.9
      wiredTiger:
        engineConfig:
          cacheSizeRatio: 0.5
          directoryForIndexes: false
          journalCompressor: snappy
        collectionConfig:
          blockCompressor: snappy
        indexConfig:
          prefixCompression: true
    operationProfiling:
      mode: slowOp
      slowOpThresholdMs: 100
      rateLimit: 100
1 Like