apiVersion: v1
kind: ReplicationController
metadata:
  name: mysql-slave
  labels:
    name: mysql-slave
spec:
  replicas: 1
  selector:
    name: mysql-slave
  template:
    metadata:
      labels:
        name: mysql-slave
    spec:
      containers:
        - name: slave
          image: paulliu/mysql-master:0.1
          ports:
            - containerPort: 3306
          env:
            - name: MYSQL_ROOT_PASSWORD
              value: "test"
            - name: MYSQL_REPLICATION_USER
              value: 'demo'
            - name: MYSQL_REPLICATION_PASSWORD
              value: 'demo'
          volumeMounts:
            - name: mysql-slave-data
              mountPath: /opt/mysql
      nodeSelector:
        az: "us-west-2c"
      volumes:
      - name: mysql-slave-data
        persistentVolumeClaim:
          claimName: mysql-slave-pvc
