IP address is not assigned to ingress object
jakuboskera opened this issue · 2 comments
Describe the bug
Status of Ingress is not updated - IP address of instance of nginx-ingress-controller is not assigned to ingress objects which are managed by this nginx-ingress-controller instance.
To Reproduce
Steps to reproduce the behavior:
- Deploy nginx-ingress-operator by following https://github.com/nginxinc/nginx-ingress-operator/blob/master/docs/manual-installation.md
- Create namespace
foo
$ kubectl create ns foo
- Deploy a new NGINX Ingress Controller using the NginxIngressController Custom Resource to namespace
foo
apiVersion: k8s.nginx.org/v1alpha1
kind: NginxIngressController
metadata:
name: nginx-ingress-controller-bar
namespace: foo
spec:
type: deployment
nginxPlus: false
image:
repository: nginx/nginx-ingress
tag: 1.10.1
pullPolicy: Always
replicas: 3
serviceType: LoadBalancer
enableCRDs: true
enableSnippets: false
enablePreviewPolicies: false
ingressClass: nginx-ingress-controller-bar
useIngressClassOnly: true
watchNamespace: foo
healthStatus:
enable: true
uri: "/my-health"
logLevel: 3
nginxStatus:
enable: true
port: 9090
allowCidrs: "127.0.0.1"
enableLeaderElection: true
enableLatencyMetrics: false
enableTLSPassthrough: true
nginxReloadTimeout: 5000
appProtect:
enable: false
- Check status of NGINX Ingress Controller instance
nginx-ingress-controller-bar
in nsfoo
$ kubectl get pods -n foo
NAME READY STATUS RESTARTS AGE
nginx-ingress-controller-bar-d96cfdb8c-7bk29 1/1 Running 0 31m
- Check if service nginx-ingress-controller-bar type of LoadBalancer has assigned External IP address
$ kubectl get svc nginx-ingress-controller-bar -n foo
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
nginx-ingress-controller-bar LoadBalancer 10.100.200.228 10.11.177.34 80:32601/TCP,443:30979/TCP 31m
- Create example app
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
namespace: foo
spec:
selector:
matchLabels:
app: nginx
replicas: 1
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: nginx
namespace: foo
spec:
type: ClusterIP
ports:
- port: 80
protocol: TCP
targetPort: 80
selector:
app: nginx
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: nginx
namespace: foo
annotations:
kubernetes.io/ingress.class: nginx-ingress-controller-bar
spec:
rules:
- host: nginx.example.com
http:
paths:
- path: /
pathType: Prefix
backend:
serviceName: nginx
servicePort: 80
# UPDATE - find that annotation kubernetes.io/ingress.class has no effect in K8s version >=1.18,
# so I also tried this YAML manifest with .spec.ingressClassName specified, but without effect
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: nginx
namespace: foo
spec:
ingressClassName: nginx-ingress-controller-bar
rules:
- host: nginx.example.com
http:
paths:
- path: /
pathType: Prefix
backend:
serviceName: nginx
servicePort: 80
- Check if Ingress
nginx
in namespacefoo
has assigned IP address10.11.177.34
(External IP of nginx-ingress-controller-bar)
$ kubectl get ingress nginx -n foo
NAME CLASS HOSTS ADDRESS PORTS AGE
nginx <none> nginx.example.com 80 97m
Expected behavior
Ingress nginx
in ns foo
will have assigned IP address. I have been waiting for 1 hour but without success.
Your environment
- Version of the NGINX Ingress Operator: 0.1.0
- Version of the Ingress Controller: 1.10.1
- Version of Kubernetes: v1.18.8
- Kubernetes platform: TKGI
- Using NGINX or NGINX Plus: NGINX
Additional context
I tried to check events from the ingress nginx
but no message related to assigned IP address:
$ kubectl describe ing nginx -n foo
Name: nginx
Namespace: foo
Address:
Default backend: default-http-backend:80 (<error: endpoints "default-http-backend" not found>)
Rules:
Host Path Backends
---- ---- --------
nginx.example.com
/ nginx:80 (10.136.12.3:8080)
Annotations: kubernetes.io/ingress.class: nginx-ingress-controller-bar
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal AddedOrUpdated 12m (x4 over 110m) nginx-ingress-controller Configuration for foo/nginx was added or updated
Normal AddedOrUpdated 12m (x4 over 110m) nginx-ingress-controller Configuration for foo/nginx was added or updated
Normal AddedOrUpdated 12m (x4 over 110m) nginx-ingress-controller Configuration for foo/nginx was added or updated
I also tried to check logs of NGINX Ingress Controller instance nginx-ingress-controller-bar
but no information about errors, ip address, ingress status etc.
I thought it could be related to RBAC because I am using ingress from api group extensions
instead of networking.k8s.io
and api group networking.k8s.io
is automatically specified in ClusterRole nginx-ingress-role
which is automatically generated, so I tried to add to this ClusteRole to api group extensions
there where is networking.k8s.io
, but again without success.
Hi @jakuboskera
Could you add the following to the NginxIngressController resource?
reportIngressStatus:
enable: true
which corresponds to https://github.com/nginxinc/nginx-ingress-operator/blob/master/docs/nginx-ingress-controller.md#nginxingresscontrollerreportingressstatus , which isn't enabled by default
that should enable reporting the status
Hi @pleshakov
oh yes, once I added these two fields to the NginxIngressController resource, the status of ingress object has been immediately updated with assigned IP address.
Thanks a lot!