Kubernetes ingress with default config does not work

2/10/2019

I have a problem with ingress. It just doesn't work. How to understand and find what is wrong?

I have kubernetes bare metal.

Installed helm chart

helm install stable/nginx-ingress --name ingress --namespace nginx-ingress

In the same namespace deployed ingress

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: test-ingress
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  rules:
  - http:
      paths:
      - path: /test
        backend:
          serviceName: efk-kibana
          servicePort: 5601

Changed the ingress type of the service from LoadBalancer to NodePort because it was not created otherwise.

After installation

curl http://example.com – get an answer example page.

Now all services work for me through NodePort, for example - myweb.com:31555.

In any tutorials does not write that i need to add something to / etc / hosts or something like that.

Thanks for the help.

-- JDev
kubernetes
kubernetes-ingress

1 Answer

2/10/2019

If you're using a baremetal cluster, you're missing a piece of the puzzle.

Ingresses lie behind an ingress controller - you still need to expose that using a service with Type=LoadBalancer which isn't possible by default with a cloud provider.

There is however, a solution. MetalLB is a provider which will allow you to specify IPs for services with type LoadBalancer.

If you deploy this with a layer 2 configuration and update your ingress controller deployment, it will work without needing NodePort.

-- jaxxstorm
Source: StackOverflow