Difficulty: beginner
Estimated Time: 30 minutes

The Mcrouter Operator was built with the Ansible Operator SDK. It is not yet intended for production use.

Mcrouter is a Memcached protocol router for scaling Memcached deployments. It's a core component of cache infrastructure at Facebook and Instagram where mcrouter handles almost 5 billion requests per second at peak.

Mcrouter features:

  • Memcached ASCII protocol
  • Connection pooling
  • Multiple hashing schemes
  • Prefix routing
  • Replicated pools
  • Production traffic shadowing
  • Online reconfiguration
  • Flexible routing

Mcrouter is developed and maintained by Facebook.

At this point in our training, we should have a basic understanding of the Operator pattern.

  • Ansible Operator is an Operator which is powered by Ansible.
  • Custom Resource events trigger Ansible tasks as opposed to the traditional approach of handling these events with Go code.

Thank you for taking a closer look at the Ansible Operator. For more Information, check out the links below:

Git Hub




Mcrouter Operator powered by Ansible Operator

Step 1 of 5

Deploying the Mcrouter Operator

Let's begin my creating a new project called mcrouter:

oc new-project mcrouter

Let's use one command to deploy the Mcrouter CRD, Service Account, Role, RoleBinding, and Operator Deployment into the cluster:

oc apply -f https://raw.githubusercontent.com/geerlingguy/mcrouter-operator/master/deploy/mcrouter-operator.yaml

Let's now verify that all the objects were successfully deployed. Begin by verifying the kind: Mcrouter CRD:

oc get crd

Verify the mcrouter-operator Service Account. This Service Account is responsible for the identity of the Mcrouter Operator Deployment.

oc get sa

Verify the mcrouter-operator Role. This Role defines the Role-Based Access Control for the mcrouter-operator Service Account.

oc get role

Verify the mcrouter-operator RoleBinding. This RoleBinding applies our Role to the mcrouter-operator Service Account.

oc get rolebinding

Finally, we will verify that the Mcrouter Deployment and its associated pod are successfully running:

oc get deploy,pod

This Deployment consists of two containers: operator and ansible. The ansible container exists only to expose the standard Ansible stdout logs. The operator container contains our Ansible Operator Mcrouter roles/playbooks. Observe the log files for both containers:

oc logs deploy/mcrouter-operator -c operator

Observe the log files for the Ansible container (it should currently be empty because we have yet to create a Custom Resource).

oc logs deploy/mcrouter-operator -c ansible

Observe the Service exposing the Operator's Prometheus metrics endpoint. Ansible-Operator automatically registers this endpoint for you.

oc get svc -l name=mcrouter-operator