# How to automatically start replication on the cluster1-pxc-0 pod only

**URL:** <https://forums.percona.com/t/how-to-automatically-start-replication-on-the-cluster1-pxc-0-pod-only/9979>\
**Category:** Percona XtraDB Cluster 5.x\
**Created:** [April 6, 2021, 7:35pm UTC](https://forums.percona.com/t/how-to-automatically-start-replication-on-the-cluster1-pxc-0-pod-only/9979 "2021-04-06T19:35:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lreyes](https://avatars.discourse-cdn.com/v4/letter/l/5e9695/32.png) [@lreyes](https://forums.percona.com/u/lreyes)\
**Post date:** [April 6, 2021, 7:35pm UTC](https://forums.percona.com/t/how-to-automatically-start-replication-on-the-cluster1-pxc-0-pod-only/9979/1 "2021-04-06T19:35:53Z")

</div>

We are planning to eventually upgrade to a Percona XtraDB cluster for our primary databases. However, we are currently using the Percona XtraDB Cluster for our read replicas. One of the pods (cluster1-pxc-0) is configured to be a slave of our primary MySQL database and that takes care of synching with the other pods. We’ve setup our pxc configuration to have `skip-slave-start` so that it does not start replication on the other 2 pods. However, we want replication to be automatically started on cluster1-pxc-0 because if the pod restarts, replication stops.

Any ideas on how to automatically start replication on only one pod?

---

<div class="post-metadata">

**Author:** ![vadimtk](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/vadimtk/32/9528_2.png) [@vadimtk](https://forums.percona.com/u/vadimtk)\
**Post date:** [April 8, 2021, 7:23pm UTC](https://forums.percona.com/t/how-to-automatically-start-replication-on-the-cluster1-pxc-0-pod-only/9979/2 "2021-04-08T19:23:36Z")

</div>

That sounds tricky and the only way I can think about is using side car containers.  
We do not have it yet, but they will be supported in the next Operator release, see  
[https://github.com/percona/roadmap/issues/11](https://github.com/percona/roadmap/issues/11)

Then by exposing POD name you can run a custom script in a side car container, for example using:

> **[Expose Pod Information to Containers Through Environment Variables](https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information/)**
>
> This page shows how a Pod can use environment variables to expose information about itself to containers running in the Pod, using the downward API. You can use environment variables to expose Pod fields, container fields, or both.
> In Kubernetes,...

I did not test it, just an idea I would try
