apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    letschess.service: userservice-db
    app: userservice
    version: "1.0"
  name: userservice-db
  namespace: letschess
spec:
  replicas: 1
  selector:
    matchLabels:
      letschess.service: userservice-db
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        letschess.service: userservice-db
        app: userservice
        version: "1.0"
    spec:
      containers:
      - image: mysql:8.0.24
        imagePullPolicy: IfNotPresent
        args:
        - --default-authentication-plugin=mysql_native_password
        env:
        - name: MYSQL_ROOT_PASSWORD
          value: letschess123
        name: userservice-db
        ports:
        - containerPort: 3306
        resources:
          limits:
            memory: "256Mi"
            cpu: "500m"
        volumeMounts:
        - mountPath: /var/lib/mysql
          name: userservice-db-data
      hostname: userservice-db
      restartPolicy: Always
      volumes:
      - name: userservice-db-data
        persistentVolumeClaim:
          claimName: userservice-db-data
      
  