From 68a8e39588cc78d95a6055ad41b5ddcc76bcadac Mon Sep 17 00:00:00 2001 From: sshermat Date: Sat, 17 Aug 2024 16:22:07 +0500 Subject: [PATCH] done --- docker-mysql-kubernetes.yaml | 69 ++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 docker-mysql-kubernetes.yaml diff --git a/docker-mysql-kubernetes.yaml b/docker-mysql-kubernetes.yaml new file mode 100644 index 0000000..54d37d5 --- /dev/null +++ b/docker-mysql-kubernetes.yaml @@ -0,0 +1,69 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: mysql + namespace: default +spec: + replicas: 1 + selector: + matchLabels: + app: mysql + template: + metadata: + labels: + app: mysql + spec: + containers: + - name: mysql + image: mysql + ports: + - containerPort: 3306 + env: + - name: MYSQL_DATABASE + value: example + - name: MYSQL_USER + value: mysql + - name: MYSQL_PASSWORD + valueFrom: + secretKeyRef: + name: mysql-secret + key: MYSQL_PASSWORD + volumeMounts: + - name: mysql-data + mountPath: /var/lib/mysql/data + volumes: + - name: mysql-data + persistentVolumeClaim: + claimName: mysql-pvc +--- +apiVersion: v1 +kind: Service +metadata: + name: mysql + namespace: default +spec: + ports: + - port: 3306 + selector: + app: mysql +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: mysql-pvc + namespace: default +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi +--- +apiVersion: v1 +kind: Secret +metadata: + name: mysql-secret + namespace: default +type: Opaque +data: + MYSQL_PASSWORD: MWVjZyZ4RHZ4= # Base64 encoded password (e.g., 'mysql_password') \ No newline at end of file