I am creating a cluster using microk8S platform. I have enabled metallb and ingress addons in order to create a load balancing mechanism. I found sample nginx deployment/build and I am trying to run it on my machine. My config.yaml file looks as follows:
#Deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
labels:
app: nginx
spec:
replicas: 1
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.14.2
ports:
- containerPort: 80
#Service
---
apiVersion: v1
kind: Service
metadata:
name: nginx-service
spec:
selector:
app: nginx
ports:
- protocol: TCP
port: 80
targetPort: 80
#Ingress resource
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: nginx-ingress
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
nginx.ingress.kubernetes.io/use-forwarded-headers: "true"
spec:
ingressClassName: public
rules:
- host: "api.mysite.net"
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: nginx-service
port:
number: 80
#LoadBalancer
---
apiVersion: v1
kind: Service
metadata:
name: ingresslb
namespace: ingress
spec:
selector:
name: nginx-ingress
type: LoadBalancer
ports:
- name: http
protocol: TCP
port: 80
targetPort: 80
- name: https
protocol: TCP
port: 443
targetPort: 443
After running the configuration, all services get created: All Resources
First, I test nginx-service from inside the cluster. The service works fine, as shown in the picture: Testing service
However, when I visit external ip address of ingress load balancer I just get empty page: Ingress doesn't route requests to service
I have configured /etc/hosts file to include my hostname: Hosts are updated
I don't know why my Ingress fails. Any help would be apriciated.
I have checked and compared my ingress resource configuration to sample configuration I found in official documentation but Ingress routing still doesn't work.