Reputation: 11
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-deployment
labels:
app: my-deployment-example
spec:
replicas: 2
selector:
matchLabels:
app: my-deployment-example
template:
metadata:
labels:
app: my-deployment-example
spec:
containers:
- name: pod1
image: velpegor/assignment2_apache_web:1.0
ports:
- containerPort: 80
- name: pod2
image: velpegor/assignment2_mysql_db:1.0
volumes:
- name: storage
emptyDir: {}
this is YAML file
image : velpegor/assignment2_apache_web:1.0
->
FROM php:7.3-apache
COPY index.php /var/www/html/
EXPOSE 80
CMD apachectl -D FOREGROUND
image : velpegor/assignment2_mysql_db:1.0
FROM mysql:5.7
ENV MYSQL_ROOT_PASSWORD="1234"
ENV MYSQL_DATABASE "LeeWJ"
ENV MYSQL_USER "LeeWonJun"
ENV MYSQL_PASSWORD "1234"
EXPOSE 3306
CMD ["mysqld"]
Does anyone know what should I need to do to fix that?
Thanks a lot for any suggestions
Upvotes: 0
Views: 259
Reputation: 1121
To verify that you database working correctly I suggest to make :
kubectl port-forward <your-pods> OR <your-service-name> -p <host-port> <pod-port>
example in your case:
kubectl port-forward pod/pod1 80 80
And then open an utility like MySQL workbench and try to connect , keep trying until connection established , and if you have a question thanks to ask me again or add error logs on comment .
Upvotes: 1