# Specify a port for NodePort PXC Node Expose Spec

**URL:** <https://forums.percona.com/t/specify-a-port-for-nodeport-pxc-node-expose-spec/12354>\
**Category:** Percona Operator for MySQL\
**Tags:** mysql, percona, kubernetes\
**Created:** [September 29, 2021, 12:39pm UTC](https://forums.percona.com/t/specify-a-port-for-nodeport-pxc-node-expose-spec/12354 "2021-09-29T12:39:26Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![SridharJ](https://avatars.discourse-cdn.com/v4/letter/s/eada6e/32.png) [@SridharJ](https://forums.percona.com/u/SridharJ)\
**Post date:** [September 29, 2021, 12:39pm UTC](https://forums.percona.com/t/specify-a-port-for-nodeport-pxc-node-expose-spec/12354/1 "2021-09-29T12:39:26Z")

</div>

Hi,

I have setup 2 Percona MySQL clusters using the PXC cluster operator for kubernetes and aiming an async cross site replication.

- 
  1. Exposed the PXC nodes of source cluster via NodePort.

- 
  1. Configured the source cluster nodes name, port in the replica cluster for async replication.

Data is successfully replicated and application is good 🙂

Is there a way to explicitly specify the nodePort value in the cr.yml ?

something like this

```auto
    size: 2
    expose:
      enabled: true
      nodePort: 33006
      type: NodePort

```

---

<div class="post-metadata">

**Author:** ![Slava\_Sarzhan](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/slava_sarzhan/32/3196_2.png) [@Slava\_Sarzhan](https://forums.percona.com/u/Slava_Sarzhan)\
**Post date:** [September 30, 2021, 6:57pm UTC](https://forums.percona.com/t/specify-a-port-for-nodeport-pxc-node-expose-spec/12354/2 "2021-09-30T18:57:29Z")

</div>

hi @SridharJ ,

We do not have such a possibility now. Could you please describe in more detail why it is important for you.

---

<div class="post-metadata">

**Author:** ![SridharJ](https://avatars.discourse-cdn.com/v4/letter/s/eada6e/32.png) [@SridharJ](https://forums.percona.com/u/SridharJ)\
**Post date:** [October 1, 2021, 3:31pm UTC](https://forums.percona.com/t/specify-a-port-for-nodeport-pxc-node-expose-spec/12354/3 "2021-10-01T15:31:04Z")

</div>

When the PXC source pod restart ( due to liveness failures or node maintenance) , NodePort expose assigns a random port. There is worst case scenario where all the PXC source cluster pods restart ( kube cluster maintenance ) and all of them get a random NodePort assigned when they come up. This breaks the replication on the PXC replication pod since the configured PXC source nodes port has changed.

It would be nice to have if the NodePort explicitly specified such that replica cluster’s config need not be changed.

---

<div class="post-metadata">

**Author:** ![Sergey\_Pronin](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/sergey_pronin/32/14887_2.png) [@Sergey\_Pronin](https://forums.percona.com/u/Sergey_Pronin)\
**Post date:** [October 4, 2021, 8:21am UTC](https://forums.percona.com/t/specify-a-port-for-nodeport-pxc-node-expose-spec/12354/4 "2021-10-04T08:21:49Z")

</div>

Looks like a valid use case, thanks for sharing @SridharJ .

Can you as a workaround use other Service Type (like LoadBalancer)?

---

<div class="post-metadata">

**Author:** ![SridharJ](https://avatars.discourse-cdn.com/v4/letter/s/eada6e/32.png) [@SridharJ](https://forums.percona.com/u/SridharJ)\
**Post date:** [October 4, 2021, 12:43pm UTC](https://forums.percona.com/t/specify-a-port-for-nodeport-pxc-node-expose-spec/12354/5 "2021-10-04T12:43:19Z")

</div>

Ours is a custom kube cluster build and doesn’t have any cloud provider to assign an external IP.  
We right now consider the option of NodePort for this cross cluster use case.
