-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add use-cluster-ip annotation for ingress resources #4862
Conversation
👷 Deploy request for nginx-kubernetes-ingress pending review.Visit the deploys page to approve it
|
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #4862 +/- ##
=======================================
Coverage 52.10% 52.11%
=======================================
Files 60 60
Lines 17376 17394 +18
=======================================
+ Hits 9054 9065 +11
- Misses 8008 8011 +3
- Partials 314 318 +4 ☔ View full report in Codecov by Sentry. |
docs/content/configuration/ingress-resources/advanced-configuration-with-annotations.md
Outdated
Show resolved
Hide resolved
…ation-with-annotations.md Co-authored-by: Alan Dooley <[email protected]> Signed-off-by: Jim Ryan <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏻
@j1m-ryan has this been tested outside the default namespace? |
this is a welcomed feature, we're planning to use this once it's released. for context in the issue below, i'm using the we're doing some testing, and possibly found a bug. that or some documentation needs to be added the following manifests work fine: ---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: podinfo
namespace: podinfo
annotations:
nginx.org/use-cluster-ip: "True"
spec:
ingressClassName: nginx
rules:
- host: localhost
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: podinfo
port:
number: 9898
---
apiVersion: v1
kind: Service
metadata:
name: podinfo
labels:
helm.sh/chart: podinfo-6.5.3
app.kubernetes.io/name: podinfo
app.kubernetes.io/version: "6.5.3"
app.kubernetes.io/managed-by: Helm
spec:
type: ClusterIP
ports:
- port: 9898
targetPort: http
protocol: TCP
name: http
- port: 9999
targetPort: grpc
protocol: TCP
name: grpc
selector:
app.kubernetes.io/name: podinfo the following manifest does not work. note the comment in the ---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: podinfo
namespace: podinfo
annotations:
nginx.org/use-cluster-ip: "True"
spec:
ingressClassName: nginx
rules:
- host: localhost
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: podinfo
port:
name: http # cannot use named port it seems like the ingress controller won't generate a valid config with the above $ k exec -it deploy/nginxinc-ingress-nginx-ingress-controller -c nginx-ingress -- nginx -T
2024/01/22 21:34:39 [emerg] 47#47: invalid port in upstream "podinfo.podinfo.svc.cluster.local:0" in /etc/nginx/conf.d/podinfo-podinfo.conf:3
nginx: [emerg] invalid port in upstream "podinfo.podinfo.svc.cluster.local:0" in /etc/nginx/conf.d/podinfo-podinfo.conf:3
nginx: configuration file /etc/nginx/nginx.conf test failed
command terminated with exit code 1 if it helps, the following does work: ---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: podinfo
namespace: podinfo
annotations:
nginx.org/use-cluster-ip: "False" # use Pod IP
spec:
ingressClassName: nginx
rules:
- host: localhost
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: podinfo
port:
name: http # named port now works is this intentional behavior of the |
Does the trailing comment on the port line cause any error by itself? |
The error happens with and without the comment on that line. I added the comment to call out the difference from the working manifest |
Proposed changes
#4665
This adds the
nginx.org/use-cluster-ip
boolean annotation to the ingress resource. It defaults tofalse
.Manual Tests
use-cluster-ip: true
, but the tea minion is not below)Checklist
Before creating a PR, run through this checklist and mark each as complete.