Skip to content
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

Not All Annotation work in Ingress #10719

Closed
fovea-group opened this issue Dec 3, 2023 · 6 comments
Closed

Not All Annotation work in Ingress #10719

fovea-group opened this issue Dec 3, 2023 · 6 comments
Labels
needs-kind Indicates a PR lacks a `kind/foo` label and requires one. needs-priority needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. triage/needs-information Indicates an issue needs more information in order to work on it.

Comments

@fovea-group
Copy link

Ok, so i write simply yaml:

apiVersion: v1
kind: Namespace
metadata:
  name: annotation-not-work
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: web-server
  namespace: annotation-not-work
spec:
  selector:
    matchLabels:
      app: web
  template:
    metadata:
      labels:
        app: web
    spec:
      containers:
      - name: httpd
        image: httpd:2.4.53-alpine
        ports:
        - containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
  name: web-server-service
  namespace: annotation-not-work
spec:
  selector:
    app: web
  ports:
    - protocol: TCP
      port: 5000
      targetPort: 80
---
apiVersion: v1
kind: Secret
metadata:
  name: fe-certificate-secret
  namespace: annotation-not-work
type: kubernetes.io/tls
data:
  tls.crt: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUREakNDQWZZQ0NRRGtuaFFUT0k3UndqQU5CZ2txaGtpRzl3MEJBUVVGQURCSk1Rc3dDUVlEVlFRR0V3SkoKVkRFT01Bd0dBMVVFQ0JNRlNYUmhiSGt4RkRBU0JnTlZCQW9UQzJObGNuUnBabWxqWVhSbE1SUXdFZ1lEVlFRRApFd3RqWlhKMGFXWnBZMkYwWlRBZUZ3MHlNekV5TURJeE1UUXlORGxhRncweU5EQXhNREV4TVRReU5EbGFNRWt4CkN6QUpCZ05WQkFZVEFrbFVNUTR3REFZRFZRUUlFd1ZKZEdGc2VURVVNQklHQTFVRUNoTUxZ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TzZuUDkvYStVVmZOMTg5MEVlREFBVjBzWnZYL1RIK1RkM2Q2bERuRGlpMHZxWkhJMXJDOVlpenVQL3pmSgpaNHJzVmdRc0lzMnlNTDZ5cnphTHRCbFVTc2ZzQmZGeS82bUM2ZE9VZXF4ZE1ZdnU2QWpnCi0tLS0tRU5EIFJTQSBQUklWQVRFIEtFWS0tLS0tCg==
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: web-server-ingress
  namespace: annotation-not-work
spec:
  ingressClassName: nginx
  tls:
    - hosts: 
      - certificate
      secretName: fe-certificate-secret
  rules:
  - host: certificate
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: web-server-service
            port:
              number: 5000

This YAML create deployment, service, SECRET WITH CN = certificate and ingress for host "certificate". Ok, now add in your host file "127.0.0.1 certificate" and with postman make GET to "https://certificate:443".

This call work and CERTIFICATE IS RIGHT:
image

Now change ingress YAML with this (change hostname), and add in your host file "127.0.0.1 certificate-cn-different" and with postman make GET to "https://certificate-cn-different:443":

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: web-server-ingress
  namespace: annotation-not-work
spec:
  ingressClassName: nginx
  tls:
    - hosts: 
      - certificate-cn-different
      secretName: fe-certificate-secret
  rules:
  - host: certificate-cn-different
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: web-server-service
            port:
              number: 5000

This call work but CERTIFICATE IS DEFAULT (ok this is expected behaviour. Ingress make check on CN but is not correct for new hostname so return default certificate):
image

NOW MY PROBLEM
My Scenario is that i want disabled check on certificate in nginx ingress. I want make this by nginx annotation.
So...change YAML with this (i try some annotation but nothing work):

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: web-server-ingress
  namespace: annotation-not-work
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
    nginx.ingress.kubernetes.io/proxy-ssl-verify: "false"
    nginx.ingress.kubernetes.io/proxy-ssl-verify-depth: "1"
    nginx.ingress.kubernetes.io/proxy-ssl-server-name: "certificate"
spec:
  ingressClassName: nginx
  tls:
    - hosts: 
      - certificate-cn-different
      secretName: fe-certificate-secret
  rules:
  - host: certificate-cn-different
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: web-server-service
            port:
              number: 5000

My expectation was that my last request worked and return self-signed certificate. But not work and return always default kubernetes certificate.
SEEMS THAT ANNOTATION NOT CHANGE NGINX.CONF FILE TO DISABLE CN CHECK

WHY???

@fovea-group fovea-group added the kind/bug Categorizes issue or PR as related to a bug. label Dec 3, 2023
@k8s-ci-robot k8s-ci-robot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Dec 3, 2023
@k8s-ci-robot
Copy link
Contributor

This issue is currently awaiting triage.

If Ingress contributors determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@fovea-group fovea-group changed the title Not All Annotation not work in Ingress Not All Annotation work in Ingress Dec 3, 2023
@longwuyuan
Copy link
Contributor

Duplicate of #10682

@fovea-group when new issue button is clicked, the template of a new issue asks many questions. You have not answered any of those questions in this issue and not answered any questions in the other issue #10682 . Please close one issue as they are duplicates and please answer the questions asked in the new issue template

/remove-kind bug
/triage needs-information

@k8s-ci-robot k8s-ci-robot added triage/needs-information Indicates an issue needs more information in order to work on it. needs-kind Indicates a PR lacks a `kind/foo` label and requires one. and removed kind/bug Categorizes issue or PR as related to a bug. labels Dec 3, 2023
@fovea-group
Copy link
Author

fovea-group commented Dec 4, 2023

Ok...can you explain me in this issue "#10682" what questions not have a answer? I thinked that response all question. So, i will open new right issue

@longwuyuan
Copy link
Contributor

  • We don't test on docker-desktop and its not likely that anyone will install docker-desktop to try reproduce this issue
  • I think first you should close one of two issues so that the problem is tracked only in one issue
  • I think you are reporting problems with the annotation proxy-ssl-verify-depth: "1" but a reader will need some kind of step-by-step instruction process, that can be used on a minikube or kind cluster
  • Do you have this in a cloud or other cluster ?
  • Depth of 1 has this explaining https://stackoverflow.com/questions/71051081/what-does-ssl-verify-depth-mean-in-nginx-conf
the default depth of 1 means the client certificate can be self-signed or has to be signed by a CA which is directly known to the server (i.e. the CA's certificate is under SSLCACertificatePath)

But there is no information on SNI for the second host name you used and so on

@longwuyuan
Copy link
Contributor

The cert in the secret on Kubernetes does not know have this hostname certificate-cn-different in subject or alternate-subject. This is my opinion. I could be wrong.

In any case this is a duplicate of #10682 so closing

/close

@k8s-ci-robot
Copy link
Contributor

@longwuyuan: Closing this issue.

In response to this:

The cert in the secret on Kubernetes does not know have this hostname certificate-cn-different in subject or alternate-subject. This is my opinion. I could be wrong.

In any case this is a duplicate of #10682 so closing

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-kind Indicates a PR lacks a `kind/foo` label and requires one. needs-priority needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. triage/needs-information Indicates an issue needs more information in order to work on it.
Projects
Archived in project
Development

No branches or pull requests

3 participants