diff --git a/qa-upgrade/mysql/mysql-replica.yaml b/qa-upgrade/mysql/mysql-replica.yaml new file mode 100644 index 0000000..4aabcc4 --- /dev/null +++ b/qa-upgrade/mysql/mysql-replica.yaml @@ -0,0 +1,75 @@ +apiVersion: v1 +kind: ReplicationController +metadata: + name: mysql + labels: + name: mysql +spec: + replicas: 1 + selector: + name: mysql + template: + metadata: + labels: + name: mysql + spec: + initContainers: + - name: init + image: busybox + imagePullPolicy: IfNotPresent + command: + - sh + - -c + - | + sysctl -w net.ipv4.tcp_keepalive_time=300 + sysctl -w net.ipv4.tcp_keepalive_intvl=10 + sysctl -w net.ipv4.tcp_keepalive_probes=3 + securityContext: + privileged: true + containers: + - name: mysql + image: mysql:8.0.33 + args: ["--character-set-server=utf8mb4", "--collation-server=utf8mb4_unicode_ci", "--max_connections=2000", "--binlog_expire_logs_seconds=432000","--sql_mode=STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION"] + ports: + - containerPort: 3306 + volumeMounts: + - name: mysql-data-qa + mountPath: /var/lib/mysql + env: + - name: MYSQL_ROOT_PASSWORD + value: "Beaconfire@2099" + - name: MYSQL_DATABASE + value: "devops" + - name: MYSQL_USER + value: "devops" + - name: MYSQL_PASSWORD + value: "devops" + volumes: + - name: mysql-data-qa + hostPath: + path: /data/qa/mysql + affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: "kubernetes.io/hostname" + operator: In + values: + - bfs-k8snode-10-2-0-9.hetzner.base.beaconfireinc.com +--- +apiVersion: v1 +kind: Service +metadata: + name: mysql + labels: + name: mysql +spec: + selector: + name: mysql + ports: + - protocol: TCP + port: 3306 + targetPort: 3306 + # nodePort: 30026 + type: NodePort diff --git a/qa-upgrade/mysql/mysql.yaml b/qa-upgrade/mysql/mysql.yaml index 4aabcc4..3bbb8b2 100644 --- a/qa-upgrade/mysql/mysql.yaml +++ b/qa-upgrade/mysql/mysql.yaml @@ -1,17 +1,17 @@ -apiVersion: v1 -kind: ReplicationController +apiVersion: apps/v1 +kind: StatefulSet metadata: name: mysql - labels: - name: mysql spec: replicas: 1 + serviceName: mysql selector: - name: mysql + matchLabels: + app: mysql template: metadata: labels: - name: mysql + app: mysql spec: initContainers: - name: init @@ -72,4 +72,4 @@ spec: port: 3306 targetPort: 3306 # nodePort: 30026 - type: NodePort + type: NodePort \ No newline at end of file