- In a seperate terminal run
minikube start
- Under the
webook
directory, runmake docker
This will rebuild thewebook-app
binary and subsequently use it to build the docker imagexjiang91/webook
, versionv0.0.1
. Modify the image prefix in theDockerfile
if needed. - run
docker tag $(docker images xjiang91/webook -q) xjiang91/webook:v0.0.1 && docker push xjiang91/webook:v0.0.1
This will tage the image asxjiang91/webook:v0.0.1
and push to docker hub. - Run the following commands to start the k8s service:
chmod 700 k8s.sh && ./k8s.sh
There are two ways to access the services:
- To access a service (e.g.webook) via nodePort, run in terminal
minikube service webook --url
, and grab the address and go to the brower to visit it, e.g.http://192.168.76.2:32225/hello
.
Similary, you can access the mysql service byminikube service webook-mysql --url
, and the redis service byminikube service webook-redis --url
. You can then use the IP address and port to login. - If the service type is
LoadBalancer
, you can also open a tunnel to the minikube cluster by running in a seperate terminal:minikube tunnel
and keep that terminal alive, then usekubectl get services
to check the EXTERNAL-IP and port.
For more details about minikube
, please refer to the official documentation: https://minikube.sigs.k8s.io/docs/handbook/