Skip to content

Instantly share code, notes, and snippets.

@aliartiza75
Last active August 22, 2019 18:42
Show Gist options
  • Save aliartiza75/25aee22e4dbed9cc3eb1fe0c4697babf to your computer and use it in GitHub Desktop.
Save aliartiza75/25aee22e4dbed9cc3eb1fe0c4697babf to your computer and use it in GitHub Desktop.
It is the final manifest for mysql
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: mysql
namespace: test-namesapce
spec:
serviceName: "mysql"
selector:
matchLabels:
app: mysql
replicas: 1
template:
metadata:
labels:
app: mysql
spec:
initContainers:
- image: busybox
name: mysql-volume-cleaner
args: [/bin/sh, -c, 'rm -rf /var/lib/mysql/lost+found || true']
volumeMounts:
- mountPath: /var/lib/mysql
name: mysql-pvc
containers:
- image: mysql:5.7
name: mysql
env:
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: mysql
key: mysql-root-password
ports:
- containerPort: 3306
name: tcp
volumeMounts:
- mountPath: /var/lib/mysql
name: mysql-pvc
volumeClaimTemplates:
- metadata:
name: mysql-pvc
spec:
accessModes: [ "ReadWriteOnce" ]
storageClassName: ibmc-block-bronze
resources:
requests:
storage: 2Gi
---
apiVersion: v1
kind: Service
metadata:
labels:
app: mysql
name: mysql-svc
namespace: test-namesapce
spec:
ports:
- name: "mysql-port"
port: 3306
targetPort: 3306
selector:
app: mysql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment