# Headless service for stable DNS entries of StatefulSet members.
# MySQL master will have name mysql-0.mysql, use it for writes. 
apiVersion: v1
kind: Service
metadata:
  name: mysql
  labels:
    app: mysql
spec:
  ports:
  - name: mysql
    port: 3306
  clusterIP: None  # no single service IP
  selector:
    app: mysql
---
# Client service for connecting to any MySQL instance for reads.
# MySQL replicas name will be mysql-1.mysql, mysql-2.mysql, etc. 
apiVersion: v1
kind: Service
metadata:
  name: mysql-read
  labels:
    app: mysql
spec:
  ports:
  - name: mysql
    port: 3306
  selector:
    app: mysql


