I have a docker image containing an angular app hosted on an nginx server. I have deployed this on PKS cluster successfully and can access this pod through the service having a load balancer. However, when I make service type clusterIP and try to access it through ingress. I get a blank page.
Lets say PKS ingress controller is running on a host named example.com as shown below. Now when we access the URL example.com/ui. I get a blank page though I have mentioned the service and port.What am I doing wrong? How can I get the angular app display for the ingress path? Btw I can access the angular app through the service.
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
labels:
app: {{ .Release.Name }}
name: {{ .Release.Name }}-ingress
namespace: {{ .Values.nameSpace }}
annotations:
ncp/use-regex: "true"
ingress.kubernetes.io/rewrite-target: /
spec:
rules:
- host: example.com
http:
paths:
- path: {{ .Values.service.path }}
backend:
serviceName: {{ .Release.Name }}-service
servicePort: {{ .Values.service.port }}
example.com
need to be resolved to IP of the kubernetes node where PKS ingress controller is running. You could verify this by nslookup example.com
or dig example.com
. You could have registered with external DNS provider where DNS system will take care of resolving the hostname example.com
to IP. If you don't have a real domain registered with external DNS provider then you could change the /etc/hosts
file of the system from where you are accessing to add hostname to IP mapping.
Also servicePort
specified in ingress should match with port
specified in the service.