docker cp db.sql [mysql_container_id]:/db.sql (Copy the database file to db container)
docker exec -it [mysql_container_id] /bin/bash (exec into db container)
mysql -u root -p (login into mysql)
ENTER PASSWORD as "password"
source db.sql (Run db.sql file to import database)
Note: We can find mysql_container_id from "docker ps" command
Run the application
Run the application on http://localhost:5000 if you are running on local or http://[IP_ADDR]:5000 where IP_ADDR is IP address where your node-js service is exposed.
If everything works well, you will see something like this:
To Run HPA Demo follow the steps below:
kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
kubectl edit deploy -n kube-system metrics-server (That will open a text editor with the deployment yaml-file)
Add "- --kubelet-insecure-tls" spec.template.spec.containers.args
kubectl apply -f __hpa.yaml
Visit http://localhost:5000/upscale/30 if you are running on local or http://[IP_ADDR]:5000/upscale/30 to increase the load on pods, it will upscale the number of pods to 5 as per the current configuration. And, it will downscale to 1 depending upon the load.