How To Test and Deploy Kubernetes Operator for MySQL(PXC) in OSX/macOS?

kubernetes on mac osxIn this blog post, I’m going to show you how to test Kubernetes locally on OSX/macOS. Testing Kubernetes without having access to a cloud operator in a local lab is not as easy as it sounds. I’d like to share some of my experiences in this adventure. For those who have already experienced in Virtualbox & Vagrant combination, I can tell you that it doesn’t work. Since Kubernetes will require virtualization, setting another virtual environment within another VirtualBox has several issues. After trying to bring up a cluster for a day or two, I gave up my traditional lab and figured out that Kubernetes has an alternate solution called minikube.


If your OSX/macOS doesn’t have brew I strongly recommend installing it. My OSX/macOS version at the time of this post was macOS 10.14.3 (18D109).

Once minikube is installed, we’ll need to start the virtual environment that is required to run our operator.

I’m starting my minikube environment with 4Gb memory since our Percona Xtradb(PXC) Cluster will have 3 MySQL nodes + 1 ProxySQL pod.

We’re now ready to install Install Percona XtraDB Cluster on Kubernetes.


Clone and download Kubernetes Operator for MySQL.

Here we have to make the following modifications for this operator to work on OSX/macOS.

  1. Reduce memory allocation for each pod.
  2. Reduce CPU usage for each pod.
  3. Change the topology type (because we want to run all PXC instances on one node).

We’re now ready to deploy our PXC via the operator.

Here we’re ready to monitor the progress of our deployment.

If any of the nodes is having difficulty passing any STATUS to Running state

In order to connect to this cluster, we’ll need to deploy a client shell access.

A few things to remember:

  • Secrets for this setup are under deploy/secrets.yaml, you can decode via

  • To reconnect shell

  • To redeploy the pod delete first and repeat above steps without configuration changes

  • To stop and delete  minikube virtual environment



Photo by frank mckenna on Unsplash

Share this post

Comments (3)

  • Dikshit Reply

    Very helpful post. Thanks for sharing with us.

    March 25, 2019 at 3:08 am
  • Bajrang Panigrahi Reply

    Interesting, I will try this out.
    Thanks for sharing @alkin

    March 28, 2019 at 9:43 pm
  • wolly Reply

    when I run the command kubectl apply -f deploy/crd.yaml
    I get the error below
    error: SchemaError(io.k8s.api.core.v1.SecretProjection): invalid object doesn’t have additional properties

    Thanks for helping out.

    April 1, 2019 at 5:02 pm

Leave a Reply