Exposed application on Windows 10 machine using Kubernetes minikube cluster and Nginx ingress controller:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress-nginx-controller
annotations:
kubernetes.io/ingress.class: "nginx"
spec:
rules:
- host: testapp
http:
paths:
- path: /testapp-web-dev
pathType: Prefix
backend:
service:
name: testapp-portal-web-service
port:
number: 80
- path: /testapp-api1-dev
pathType: Prefix
backend:
service:
name: testapp-portal-api1-service
port:
number: 80
- path: /testapp-api2-dev
pathType: Prefix
backend:
service:
name: testapp-portal-api2-service
port:
number: 80
Added testapp entry into etc hosts and all is working fine locally. I can access application locally as http://testapp/testapp-web-dev or http://testapp//testapp-api1-dev
Now I'm wondering how could I expose this outside this computer which is in domain? I.e. computer name is machine1 and I want other users of domain access all its components as http://machine1/testapp-web-dev http://machine1/testapp-api1-dev or something similar.
Your ingress configuration is specifying testapp
as the host it's looking for in incoming requests.
If you change that to machine1
, and the set the machine1
host to resolve to the ip of the ingress controller service, the ingress controller should be able to successfully route requests to that host into the services on your cluster.
EDIT: You can follow this useful guide from the k8s docs that guides you through all of the required steps for setting up an ingress controller on minikube