Updates mysql to not use bitnami.

This commit is contained in:
2025-10-18 18:57:22 +00:00
parent db621755b3
commit 47c23d3f1b
3 changed files with 68 additions and 130 deletions

View File

@@ -4,34 +4,36 @@ metadata:
name: mysql name: mysql
namespace: mysql namespace: mysql
data: data:
my.cnf: | custom.cnf: |
[mysqld] [mysqld]
authentication_policy='* ,,' # Connection settings
skip-name-resolve skip-name-resolve
explicit_defaults_for_timestamp max_connections=200
basedir=/opt/bitnami/mysql max_allowed_packet=64M
plugin_dir=/opt/bitnami/mysql/lib/plugin
port={{ .apps.mysql.port }} # Character set
mysqlx=0 character-set-server=utf8mb4
mysqlx_port=33060 collation-server=utf8mb4_unicode_ci
socket=/opt/bitnami/mysql/tmp/mysql.sock
datadir=/bitnami/mysql/data # Performance tuning
tmpdir=/opt/bitnami/mysql/tmp innodb_buffer_pool_size=512M
max_allowed_packet=16M innodb_log_file_size=128M
bind-address=* innodb_flush_log_at_trx_commit=2
pid-file=/opt/bitnami/mysql/tmp/mysqld.pid innodb_flush_method=O_DIRECT
log-error=/opt/bitnami/mysql/logs/mysqld.log
character-set-server=UTF8 # Query optimization
slow_query_log=0 slow_query_log=1
long_query_time=10.0 long_query_time=2
slow_query_log_file=/var/lib/mysql/slow-query.log
# Timeout settings
wait_timeout=600
interactive_timeout=600
# Binary logging (optional, for replication)
# server-id=1
# log_bin=/var/lib/mysql/mysql-bin
# binlog_format=ROW
[client] [client]
port={{ .apps.mysql.port }} default-character-set=utf8mb4
socket=/opt/bitnami/mysql/tmp/mysql.sock
default-character-set=UTF8
plugin_dir=/opt/bitnami/mysql/lib/plugin
[manager]
port={{ .apps.mysql.port }}
socket=/opt/bitnami/mysql/tmp/mysql.sock
pid-file=/opt/bitnami/mysql/tmp/mysqld.pid

View File

@@ -1,10 +1,10 @@
name: mysql name: mysql
description: MySQL is an open-source relational database management system description: MySQL is an open-source relational database management system
version: 8.4.5 version: 9.1.0
icon: https://www.mysql.com/common/logos/logo-mysql-170x115.png icon: https://www.mysql.com/common/logos/logo-mysql-170x115.png
requires: [] requires: []
defaultConfig: defaultConfig:
image: docker.io/bitnami/mysql:8.4.5-debian-12-r0 image: mysql:9.1.0
port: 3306 port: 3306
storage: 20Gi storage: 20Gi
dbName: mysql dbName: mysql

View File

@@ -20,46 +20,13 @@ spec:
serviceAccountName: default serviceAccountName: default
automountServiceAccountToken: false automountServiceAccountToken: false
securityContext: securityContext:
fsGroup: 1001 runAsNonRoot: true
runAsUser: 999
runAsGroup: 999
fsGroup: 999
fsGroupChangePolicy: Always fsGroupChangePolicy: Always
initContainers: seccompProfile:
- name: preserve-logs-symlinks type: RuntimeDefault
image: {{ .apps.mysql.image }}
imagePullPolicy: IfNotPresent
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
readOnlyRootFilesystem: true
runAsGroup: 1001
runAsNonRoot: true
runAsUser: 1001
seccompProfile:
type: RuntimeDefault
resources:
limits:
cpu: 250m
ephemeral-storage: 1Gi
memory: 256Mi
requests:
cpu: 100m
ephemeral-storage: 50Mi
memory: 128Mi
command:
- /bin/bash
args:
- -ec
- |
#!/bin/bash
. /opt/bitnami/scripts/libfs.sh
# We copy the logs folder because it has symlinks to stdout and stderr
if ! is_dir_empty /opt/bitnami/mysql/logs; then
cp -r /opt/bitnami/mysql/logs /emptydir/app-logs-dir
fi
volumeMounts:
- name: empty-dir
mountPath: /emptydir
containers: containers:
- name: mysql - name: mysql
image: {{ .apps.mysql.image }} image: {{ .apps.mysql.image }}
@@ -69,15 +36,8 @@ spec:
capabilities: capabilities:
drop: drop:
- ALL - ALL
readOnlyRootFilesystem: true readOnlyRootFilesystem: false
runAsGroup: 1001
runAsNonRoot: true
runAsUser: 1001
seccompProfile:
type: RuntimeDefault
env: env:
- name: BITNAMI_DEBUG
value: "false"
- name: MYSQL_ROOT_PASSWORD - name: MYSQL_ROOT_PASSWORD
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
@@ -92,83 +52,59 @@ spec:
key: apps.mysql.password key: apps.mysql.password
- name: MYSQL_DATABASE - name: MYSQL_DATABASE
value: {{ .apps.mysql.dbName }} value: {{ .apps.mysql.dbName }}
- name: MYSQL_PORT - name: TZ
value: "{{ .apps.mysql.port }}" value: {{ .apps.mysql.timezone }}
ports: ports:
- name: mysql - name: mysql
containerPort: {{ .apps.mysql.port }} containerPort: {{ .apps.mysql.port }}
protocol: TCP
livenessProbe: livenessProbe:
failureThreshold: 3
initialDelaySeconds: 5
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
exec: exec:
command: command:
- /bin/bash - /bin/sh
- -ec - -c
- | - mysqladmin ping -h 127.0.0.1 -u root -p${MYSQL_ROOT_PASSWORD}
password_aux="${MYSQL_ROOT_PASSWORD:-}" initialDelaySeconds: 30
mysqladmin status -uroot -p"${password_aux}" periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 3
readinessProbe: readinessProbe:
failureThreshold: 3
initialDelaySeconds: 5
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
exec: exec:
command: command:
- /bin/bash - /bin/sh
- -ec - -c
- | - mysqladmin ping -h 127.0.0.1 -u root -p${MYSQL_ROOT_PASSWORD}
password_aux="${MYSQL_ROOT_PASSWORD:-}" initialDelaySeconds: 10
mysqladmin ping -uroot -p"${password_aux}" | grep "mysqld is alive" periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 3
startupProbe: startupProbe:
failureThreshold: 10 exec:
command:
- /bin/sh
- -c
- mysqladmin ping -h 127.0.0.1 -u root -p${MYSQL_ROOT_PASSWORD}
initialDelaySeconds: 15 initialDelaySeconds: 15
periodSeconds: 10 periodSeconds: 10
successThreshold: 1 timeoutSeconds: 5
timeoutSeconds: 1 failureThreshold: 30
exec:
command:
- /bin/bash
- -ec
- |
password_aux="${MYSQL_ROOT_PASSWORD:-}"
mysqladmin ping -uroot -p"${password_aux}" | grep "mysqld is alive"
resources: resources:
limits: limits:
cpu: 750m cpu: 1000m
ephemeral-storage: 2Gi memory: 1Gi
memory: 768Mi
requests: requests:
cpu: 500m cpu: 500m
ephemeral-storage: 50Mi
memory: 512Mi memory: 512Mi
volumeMounts: volumeMounts:
- name: data - name: data
mountPath: /bitnami/mysql mountPath: /var/lib/mysql
- name: empty-dir
mountPath: /tmp
subPath: tmp-dir
- name: empty-dir
mountPath: /opt/bitnami/mysql/conf
subPath: app-conf-dir
- name: empty-dir
mountPath: /opt/bitnami/mysql/tmp
subPath: app-tmp-dir
- name: empty-dir
mountPath: /opt/bitnami/mysql/logs
subPath: app-logs-dir
- name: config - name: config
mountPath: /opt/bitnami/mysql/conf/my.cnf mountPath: /etc/mysql/conf.d/custom.cnf
subPath: my.cnf subPath: custom.cnf
volumes: volumes:
- name: config - name: config
configMap: configMap:
name: mysql name: mysql
- name: empty-dir
emptyDir: {}
volumeClaimTemplates: volumeClaimTemplates:
- metadata: - metadata:
name: data name: data