I have an api that I am building and linking it to my nginx ingress controller to be used as a loadbalancer. My below yaml works when I change the namespace
to default
and I'm able to access the API no problem. When I change all the below to any other name space and install in that namespace, I get the error from ingress controller:
Service does not have any active Endpoint
so I thought that the nginx ingress controller (deployed in default namespace) was supposed to be able to see ingress in all namespaces. So is there something wrong with my deployment steps below?
---
apiVersion: v1
kind: Service
metadata:
name: demoapi
namespace: alex
spec:
type: ClusterIP
selector:
app: demoapi
ports:
- protocol: TCP
port: 80
targetPort: 8080
name: http
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: demoapi
namespace: alex
labels:
app: demoapi
spec:
replicas: 1
selector:
matchLabels:
app: demoapi
template:
metadata:
labels:
app: demoapi
spec:
containers:
- name: demoapi
image: myrepo/demoapi:latest
ports:
- containerPort: 8080
livenessProbe:
failureThreshold: 3
httpGet:
path: /actuator/health
port: 8080
initialDelaySeconds: 15
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 3
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: nginx
kubernetes.io/tls-acme: "true"
nginx.ingress.kubernetes.io/proxy-buffer-size: 512k
nginx.ingress.kubernetes.io/ssl-redirect: "false"
name: demoapi
namespace: alex
spec:
rules:
- host: mydomain.com
http:
paths:
- backend:
serviceName: demoapi
servicePort: 80
path: /api/v1/hello
tls:
- hosts:
- mydomain.com
secretName: mydomain-ssl-secret
I also checked nginx controller config - and it's set with default to watch all namespaces