This app is part of an assignment for the BTH master
The steps to run the app are the following:
-
Clone this repository. In Linux just use the
git clone
command -
Install and start minikube. Add the service Ingress
-
Create all deployment and services .yaml files in this way (e.g.):
kubectl create -f redis-deploy.yaml
with the outputdeployment.apps/redis-deploy created
. Note: You should perform the same procedure with the rest of pod, deploy and service files. -
Check all deployments and services are ready by executing
kubectl get pods,svc
with the following result -
Check the IPs and port to access the apps:
minikube service voting-service --url
with outputhttp://192.168.59.100:30004
-
The following screens
- We can access to the microservices externally by applying the ingress files with
kubectl apply -f voting-ingress.yaml
and outputingress.networking.k8s.io/voting-ingress configured
. We can check the ingress services are running by executingkubectl get ingress
- By executing the following command we can assure the microservices are accessible
curl --resolve result.example.com:80:192.168.59.100 http://result.example.com
- We must use minikube tunnel to check the current services available outside:
Status:
machine: minikube
pid: 3203
route: 10.96.0.0/12 -> 192.168.59.100
minikube: Running
services: []
errors:
minikube: no errors
router: no errors
loadbalancer emulator: no errors`
- As can be seen, no services are displayed within services. We have to apply changes in the already created result and voting services .yaml files. This change is to modify the NodePort to LoadBalancer. We
kubectl apply -f <name service file>
and if we check the tunnel output the services appear:
Status:
machine: minikube
pid: 3203
route: 10.96.0.0/12 -> 192.168.59.100
minikube: Running
services: [result-service]
errors:
minikube: no errors
router: no errors
loadbalancer emulator: no errors
Status:
machine: minikube
pid: 3203
route: 10.96.0.0/12 -> 192.168.59.100
minikube: Running
services: [result-service, voting-service]
errors:
minikube: no errors
router: no errors
loadbalancer emulator: no errors
- We check the external IPs and the ports to access outside:
$kubectl describe services result-service
Name: result-service
Namespace: default
Labels: app=demo-voting-app
name=result-service
Annotations: <none>
Selector: app=demo-voting-app,name=result-app-pod
Type: LoadBalancer
IP Family Policy: SingleStack
IP Families: IPv4
IP: 10.110.1.59
IPs: 10.110.1.59
LoadBalancer Ingress: 10.110.1.59
Port: <unset> 80/TCP
TargetPort: 80/TCP
NodePort: <unset> 30005/TCP
Endpoints: 10.244.0.18:80
Session Affinity: None
External Traffic Policy: Cluster
Events: <none>
$kubectl describe services voting-service
Name: voting-service
Namespace: default
Labels: app=demo-voting-app
name=voting-service
Annotations: <none>
Selector: app=demo-voting-app,name=voting-app-pod
Type: LoadBalancer
IP Family Policy: SingleStack
IP Families: IPv4
IP: 10.104.170.27
IPs: 10.104.170.27
LoadBalancer Ingress: 10.104.170.27
Port: <unset> 80/TCP
TargetPort: 80/TCP
NodePort: <unset> 30004/TCP
Endpoints: 10.244.0.21:80
Session Affinity: None
External Traffic Policy: Cluster
Events: <none>
- If we enter to a browser and enter the LoadBalancer Ingress IP with the port. In this case: 10.110.1.59:80 (result-service) and 10.104.170.27 (voting-service). We get the following result: