# Can't do backups in K8s cluster

**URL:** <https://forums.percona.com/t/cant-do-backups-in-k8s-cluster/13499>\
**Category:** Percona Backup for MongoDB\
**Created:** [December 15, 2021, 8:41pm UTC](https://forums.percona.com/t/cant-do-backups-in-k8s-cluster/13499 "2021-12-15T20:41:13Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![anon17965173](https://avatars.discourse-cdn.com/v4/letter/a/278dde/32.png) [@anon17965173](https://forums.percona.com/u/anon17965173)\
**Post date:** [December 21, 2021, 2:16am UTC](https://forums.percona.com/t/cant-do-backups-in-k8s-cluster/13499/2 "2021-12-21T02:16:03Z")

</div>

I did start from scratch, after found out the cluster was instable. Now installed everything in default namespace, both operator and cluster, and I don’t get above errors now anymore.

However, now if I want to login to Mongo, I am getting:

`$ psmdb-db $ kubectl run -i --rm --tty percona-client ...`

```auto
Error attaching, falling back to logs: unable to upgrade connection: container percona-client not found in pod percona-client_default

DNSHostNotFound: Failed to look up service "_mongodb._tcp.percona-db-psmdb-db-rs0.default.svc.cluster.local": Success

```

Altough this is not Backup related anymore I would be greatful for any hints. Description of psmdb returns ready states. I can login to the primary rs0-0 but not via the connection string referenced by percona helm charts without any replica index number.

```auto
    expose:
      enabled: true
      exposeType: ClusterIP

```

I switched `expose.enabled: false` and the `rs0` service can be resolved now. Then I get:

```auto
{"t":{"$date":"2021-12-21T02:48:12.339Z"},"s":"I", "c":"NETWORK", "id":4333208, "ctx":"ReplicaSetMonitor-TaskExecutor","msg":"RSM host selection timeout","attr":{"replica
Set":"rs0","error":"FailedToSatisfyReadPreference: Could not find host matching read preference { mode: \"nearest\" } for set rs0"}}
Error: connect failed to replica set rs0/percona-db-psmdb-db-rs0-0.percona-db-psmdb-db-rs0.default.svc.cluster.local:27017,percona-db-psmdb-db-rs0-2.percona-db-psmdb-db-rs0
.default.svc.cluster.local:27017,percona-db-psmdb-db-rs0-1.percona-db-psmdb-db-rs0.default.svc.cluster.local:27017 :

```

I imagine I have to configure

`replsets[0].configuration` which is the `custom config for mongod in replica set ` according to docs, how could one define `ReadPreference` in here to workaround the 4.4 bug I read about in a neighbouring thread. So I am looking at `replication.localPingThresholdMs` at [https://docs.mongodb.com/manual/reference/configuration-options/](https://docs.mongodb.com/manual/reference/configuration-options/) and **Read Preference for Replica Sets** [https://docs.mongodb.com/manual/core/read-preference-mechanics/#std-label-replica-set-read-preference-behavior-member-selection](https://docs.mongodb.com/manual/core/read-preference-mechanics/#std-label-replica-set-read-preference-behavior-member-selection) because `nearest` option does not seem to work for me, even though primary should be default according to Percona docs.

One cannot help to wonder how these parameters set, would this happen to be correct parameters in values.yaml, i.e.:

```auto
replsets:
  - name: rs0
    size: 3
    configuration: 
       readPreference: primaryPreferred

```

Continuing this thread here: [Could not find host matching read preference mode nearest for set rs0](https://forums.percona.com/t/could-not-find-host-matching-read-preference-mode-nearest-for-set-rs0/13596)

---

_[View the full topic](https://forums.percona.com/t/cant-do-backups-in-k8s-cluster/13499)._
