I'm having troubles setting up kubernetes ingress-nginx in order to expose my app externally. Here are the steps that I did:
Application deployment:
- Created namespace called ingress
- Deployed statefulset set resource that describes my application (let's call it testapp) in ingress namespace
- Created ClusterIP service that makes my app available in the kube cluster (testapp) in ingress namespace
Ingress nginx setup:
- Created ingress-nginx controller in namespace ingress
- Created ingress-nginx service in namespace ingress
ingress-nginx NodePort 10.102.152.58 <none> 80:30692/TCP,443:32297/TCP 6d2h
- Created ingress resource type in ingress namespace that looks like this
apiVersion: extensions/v1beta1 kind: Ingress metadata: annotations: kubernetes.io/ingress.class: nginx nginx.ingress.kubernetes.io/rewrite-target: / name: testappingress spec: rules: - host: testapp.k8s.myorg.io http: paths: - backend: serviceName: testapp servicePort: 80 path: /
If I do describe of ingress resource, I get this:
ubuntu@ip-10-0-20-81:~/ingress$ kubectl describe ingress testappingress -n ingress
Name: testappingress
Namespace: ingress
Address:
Default backend: default-http-backend:80 (<none>)
Rules:
Host Path Backends
---- ---- --------
testapp.k8s.myorg.io
/ testapp:80 (<none>)
Annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/rewrite-target: /
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal CREATE 15m nginx-ingress-controller Ingress ingress/testappingress
Normal CREATE 15m nginx-ingress-controller Ingress ingress/testappingress
Normal UPDATE 14m nginx-ingress-controller Ingress ingress/testappingress
Normal UPDATE 14m nginx-ingress-controller Ingress ingress/testappingress
If I check logs from ingress-nginx controller, I get following:
I0317 15:06:00.029706 6 event.go:221] Event(v1.ObjectReference{Kind:"Ingress", Namespace:"ingress", Name:"testappingress", UID:"2c8db73f-48c6-11e9-ae46-12bdb9ac3010", APIVersion:"extensions/v1beta1", ResourceVersion:"1185441", FieldPath:""}): type: 'Normal' reason: 'CREATE' Ingress ingress/testappingress
I0317 15:06:00.039419 6 controller.go:177] Configuration changes detected, backend reload required.
I0317 15:06:00.508433 6 controller.go:195] Backend successfully reloaded.
I0317 15:06:00.568448 6 controller.go:212] Dynamic reconfiguration succeeded.
Route53/ELB classic setup:
- Created ELB classic which points to kubernetes cluster instances and exposes port 80
- Created Route53 entry in existing hosted zone (CNAME) which points to ELB classic from above.
- Setup Health Check on ELB to point to ingress-nginx NodePort service on port: 30692 which works.
When I do:
curl http://testapp.k8s.myorg.io
I don't get any response.
Here is what I've tried to troubleshoot the problem:
If I do:
telnet testapp.k8s.myorg.io 80
It will resolve to my ELB classic DNS name
If I go into any container/pod that exist inside ingress namespace and do following:
curl http://testapp
I will get appropriate response.
From this I can conclude following:
Application is correctly deployed and available through the service that is exposed (ClusterIP) from the inside of kubernetes cluster
DNS gets resolved properly to the ELB
HealthCheck on ELB works
Not sure what else could I do to troubleshoot why I'm unable to access my service through Ingress?