I am trying to install and setup kubernetes on My System without any public Cloud Provider.
What i tried
I am able to create services and access them through ingress controller ip
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
ingress-nginx-controller LoadBalancer 10.102.16.16 192.168.49.2 80:30548/TCP,443:31812/TCP 109m
ingress-nginx-controller-admission ClusterIP 10.108.137.156 <none> 443/TCP 109m
this is my ingress
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: odoo-ingress
spec:
rules:
- host: myservice.local.com
http:
paths:
- pathType: Prefix
path: "/"
backend:
service:
name: test-service
port:
number: 80
my hosts file contains
192.168.49.2 myservice.local.com
and i am able to access my service and deployment at myservice.local.com successfully.
What i want:
public internet --> Ingress Controller --> Kubernetes Services
i want that my ingress controller listen on 127.0.0.1 and in the hosts file it should be
127.0.0.1 myservice.local.com
I want this because i want to access this cluster from public internet. I am not using any public cloud provider for kubernetes.
Minikube runs on virtual machine so in your machine there is another virtual machine with kuberentes. Ingress works but only when you are on your machine. You can't access inside kubernetes because there is no proxy between your host and virtual machine.
public internet ->>> your machine ->>> virtual machine ->> ingress controller
Switch to microk8s(no virtual box) or create nginx proxy on your machine and formward all requests to virtual machine with your kubernetes.