How to create a MySQL cluster within an Istio injected namespace?

11/26/2019

I'm currently trying to create a 2 nodes MySQL cluster in an 1.13.10 K8s using the Oracle MySQL Operator. It works fine within a standard namespace. However, once it's created within an Istio 1.4 injected namespace, the MySQL Agent, that is in charge of setting the replication up, returns the following error:

Error bootstrapping cluster: failed to create new cluster: SystemError: RuntimeError: Dba.create_cluster: ERROR: Error starting cluster: The port '33061' for localAddress option is already in use. Specify an available port to be used with localAddress option or free port '33061'.

I was not able to find any support on this so far.

How can I configure Istio to enable the agent to manage the replication ?

Below my yaml manifests:

apiVersion: v1
kind: Namespace
metadata:
  name: test
  labels:
    istio-injection: enabled
---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: mysql-agent
  namespace: test
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
  name: mysql-agent
  namespace: test
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: mysql-agent
subjects:
- kind: ServiceAccount
  name: mysql-agent
  namespace: test
---
apiVersion: v1
kind: PersistentVolume
metadata:
  name: pv-test-mysql-data0
  labels:
    namespace: test
    type: data
    app: mysql
spec:
  storageClassName: hostpath
  persistentVolumeReclaimPolicy: Retain 
  accessModes:
    - ReadWriteMany
  capacity:
    storage: 2Gi
  hostPath:
    path: /data/test/mysql/data0
    type: DirectoryOrCreate
---
apiVersion: v1
kind: PersistentVolume
metadata:
  name: pv-test-mysql-data1
  labels:
    namespace: test
    type: data
    app: mysql
spec:
  storageClassName: hostpath
  persistentVolumeReclaimPolicy: Retain 
  accessModes:
    - ReadWriteMany
  capacity:
    storage: 2Gi
  hostPath:
    path: /share/test/mysql/data1
    type: DirectoryOrCreate
---
apiVersion: v1
kind: Secret
metadata:
  name: mysql-root-user-secret
  namespace: test
stringData:
    password: password
---
apiVersion: mysql.oracle.com/v1alpha1
kind: Cluster
metadata:
  name: mysql
  namespace: test
  labels:
    app: mysql
    namespace: test
spec:
  multiMaster: true
  members: 2
  affinity:
    podAntiAffinity:
      requiredDuringSchedulingIgnoredDuringExecution:
        - labelSelector:
            matchExpressions:
              - key: "v1alpha1.mysql.oracle.com/cluster"
                operator: In
                values:
                - mysql
          topologyKey: "kubernetes.io/hostname"
  rootPasswordSecret:
    name: mysql-root-user-secret
  volumeClaimTemplate:
    metadata:
      name: data
    spec:
      storageClassName: hostpath
      accessModes:
        - ReadWriteMany
      resources:
        requests:
          storage: 2Gi
      selector:
        matchLabels:
          namespace: test
          type: data
          app: mysql
-- Chris
istio
kubernetes
mysql

0 Answers