0

Environment :

  • Using Helm v3 charts for deployment.
  • Using Bitnami MySQL charts from the following source : https://artifacthub.io/packages/helm/bitnami/mysql
  • Username and Password is generated randomly for every deployment.
  • PersistenceVolume is created of type "standard" storage class.
  • Entire k8 cluster is done on Baremetal.

When deploying for the first time, installation goes successfully, all the mysql db files get generated appropriately in the data directory. After doing uninstall and then doing the install does not work, because the mysql data directory has db and config files for previously generated credentials.

As of now, after doing uninstall, we are manually clearing the files from the node before installing. Looking forward on how to :

  • Clearing only the config files and keeping the db files intact.
  • On deleting persistent volume, clear all the files from the data directory.
  • Alter the DB with new username and password to use existing files as it is.

Persistence Volume K8 yaml

kind: PersistentVolume
apiVersion: v1
metadata:
  name: mysql-pv
  labels:
    type: local
    name: mysql-pv
spec:
  storageClassName: standard
  capacity:
    storage: 2Gi
  accessModes:
  - ReadWriteOnce
  hostPath:
    path: "/tmp/"

---

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: mysql-pvc
  labels:
    name: mysql-pvc
spec:
  accessModes:
    - ReadWriteOnce
  volumeMode: Filesystem
  resources:
    requests:
      storage: 2Gi
  selector:
    matchLabels:
      name: mysql-pv
Anthony Vinay
  • 513
  • 5
  • 17
  • Whate errors you are getting? Any output in `kubectl describe`, anything in logs? Could you provide steps how did you configure it? What Kubernetes version are you using? Could you provide output `kubectl get pv,pvc`? – PjoterS Dec 14 '20 at 16:01
  • 1
    You need to re-install the chart using the same credentials as the first time. User data is stored in a table in your database, so you can't choose to persist only your data and not users. – Ale Dec 16 '20 at 08:20

0 Answers0