<p>I have mysql deployment.yaml, in which i have some data at <strong>mysql/data</strong> directory which is in local. I want mount this data in deployment. After referring blogs some recommend <strong>hostpath</strong>. Since we are not doing ssh into nodes, i cant recommend or use <strong>hostpath</strong>. is there any way i can do with pv with EBS or any other way ? Thanks in advance.</p>

Akshay Awate
<p>Here's a minimum spec using EKS default gp2 storage class to get you started.</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: mysql
  labels:
    app: mysql
spec:
  clusterIP: None
  selector:
    app: mysql
  ports:
  - port: 3306
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: mysql
spec:
  storageClassName: gp2
  accessModes: [&quot;ReadWriteOnce&quot;]
  resources:
    requests:
      storage: 5Gi
---
apiVersion: v1
kind: Pod
metadata:
  name: mysql
  labels:
    app: mysql
spec:
  containers:
  - name: mysql
    image: mysql:8.0.28
    imagePullPolicy: IfNotPresent
    env:
    - name: MYSQL_ROOT_PASSWORD
      value: password
    ports:
    - containerPort: 3306
    volumeMounts:
    - name: mysql
      mountPath: /var/lib/mysql
  volumes:
  - name: mysql
    persistentVolumeClaim:
      claimName: mysql
</code></pre>
<p>You can connect to the mysql via <code>kubectl run -it --rm --image=mysql:8.0.28 --restart=Never mysql-client -- mysql -h mysql -ppassword</code></p>
