Sidecars with Percona Kubernetes OperatorsOur recent releases of Percona Operator for MySQL based on Percona XtraDB Cluster 1.8 and Percona Operator for MongoDB 1.7 come with a new interesting feature: Support of custom sidecars.

What is special about this? There is often a need to customize the default installation, for example, one popular request is to support your favorite monitoring system, which is different from Percona Monitoring and Management (default Prometheus monitoring for Kubernetes being one of them). Another possibility is to install utilities or debugging tools on the same node with running mysqld or mongod process.

In this blog, I will show how to deploy sidecar with my own images which come with the standard Ubuntu OS and sysbench tool. This will allow us to make sure that sysbench is running on the same Kubernetes node as the Percona XtraDB Cluster (PXC) node.

To deploy our standard cluster in Kubernetes, I will use the example cr.yaml file here
https://github.com/percona/percona-xtradb-cluster-operator/blob/main/deploy/cr.yaml with the modification to deploy sidecar.

The relevant part in the PXC section is this:

After deployment let’s check that sidecar is running with:

Now we can grab the root password with:

And login into our sidecar container as:

And prepare sysbench workload:

Now running sysbench workload in one terminal we even can get vmstat from another (it is also available in my ubuntu-sysbench image).

Conclusion

Using sidecars provides extra customization and flexibility for our Operators deployments, give it a try! But make sure you are running verified images and do not introduce intrusive operations into database workloads.

The full cr.yaml for reference:

The Percona Operators automate the creation, alteration, or deletion of members in your Percona Distribution for MySQL, MongoDB, or PostgreSQL environment.

Learn More About Percona Operators