docker-pdns/examples/kubernetes/mariadb.yaml
2023-01-15 17:06:10 +01:00

126 lines
3 KiB
YAML

---
apiVersion: apps/v1
kind: StatefulSet
metadata:
creationTimestamp: null
labels:
app.kubernetes.io/name: mariadb-pdns
app.kubernetes.io/part-of: pdns
app.kubernetes.io/component: mariadb
name: mariadb-pdns
spec:
podManagementPolicy: OrderedReady
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
app.kubernetes.io/name: mariadb-pdns
app.kubernetes.io/part-of: pdns
app.kubernetes.io/component: mariadb
serviceName: mariadb-pdns
template:
metadata:
labels:
app.kubernetes.io/name: mariadb-pdns
app.kubernetes.io/part-of: pdns
app.kubernetes.io/component: mariadb
spec:
containers:
- name: mariadb-pdns
image: mariadb:10.10
imagePullPolicy: Always
env:
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: mariadb-pdns-secret
key: password
volumeMounts:
- name: mariadb-pdns-storage
mountPath: /var/lib/mysql
- name: mariadb-pdns-config
mountPath: /etc/mysql/conf.d
ports:
- containerPort: 3306
resources:
limits:
cpu: 300m
memory: 256Mi
requests:
cpu: 50m
memory: 128Mi
volumes:
- name: mariadb-pdns-storage
persistentVolumeClaim:
claimName: mariadb-pdns-pvc
- name: mariadb-pdns-config
configMap:
name: mariadb-pdns-config
items:
- key: mariadb-override.cnf
path: mariadb-override.cnf
---
apiVersion: v1
kind: Service
metadata:
labels:
app.kubernetes.io/name: mariadb-pdns-svc
app.kubernetes.io/part-of: pdns
app.kubernetes.io/component: mariadb
name: mariadb-pdns
spec:
ports:
- name: tcp-mysql
port: 3306
protocol: TCP
targetPort: 3306
selector:
app.kubernetes.io/name: mariadb-pdns
sessionAffinity: None
type: ClusterIP
---
apiVersion: v1
kind: ConfigMap
metadata:
labels:
app.kubernetes.io/name: mariadb-pdns-config
app.kubernetes.io/part-of: pdns
app.kubernetes.io/component: mariadb
name: mariadb-pdns-config
data:
mariadb-override.cnf: |
[mysqld]
collation-server = utf8mb4_unicode_ci
init-connect='SET NAMES utf8mb4'
character-set-server = utf8mb4
innodb_buffer_pool_size = 134217728
innodb_log_file_size = 134217728
innodb-log-files-in-group = 3
binlog_format = ROW
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
labels:
app.kubernetes.io/name: mariadb-pdns-pvc
app.kubernetes.io/part-of: pdns
app.kubernetes.io/component: mariadb
name: mariadb-pdns-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
---
apiVersion: v1
kind: Secret
metadata:
labels:
app.kubernetes.io/name: mariadb-pdns-secret
app.kubernetes.io/part-of: pdns
app.kubernetes.io/component: mariadb
name: mariadb-pdns-secret
data:
username: cm9vdA==
password: cm9vdA==