Solution 1:
You need to add targetPort in your MySQL service YAML definition. Example:
apiVersion: v1
kind: Service
metadata:
name: db
labels:
name: db-service
app: demo-wordpress-app
spec:
ports:
- port: 3306
targetPort: 3306
selector:
name: mysql-app-label
This ensures that the service correctly forwards traffic to the MySQL container port.