Skip to content

Add nginx ingress annotations to prevent domain conflicts on http01 s… - #1782

Closed
alepaez wants to merge 1 commit into
cert-manager:masterfrom
alepaez:annotations_to_prevent_nginx_domain_conflict
Closed

alepaez wants to merge 1 commit into
cert-manager:masterfrom
alepaez:annotations_to_prevent_nginx_domain_conflict

Conversation

@alepaez

@alepaez alepaez commented Jun 14, 2019

Copy link
Copy Markdown

What this PR does / why we need it:

Fix wrong status code '404', expected '200' when using http01 issuer with nginx-ingress by adding nginx.org/mergeable-ingress-type: "master" and nginx.org/mergeable-ingress-type: "minion" annotations to avoid host conflicts on http01 issuer.

cert-manager creates an ingress with same host as the clients ingress, which is ignored by nginx.

This config:

---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: api
  namespace: production
  annotations:
    kubernetes.io/ingress.class: "nginx"
    certmanager.k8s.io/issuer: "letsencrypt-prod"
    certmanager.k8s.io/acme-challenge-type: http01
spec:
  tls:
  - hosts:
    - my.domain
    secretName: api-tls
  rules:
  - host: my.domain
    http:
      paths:
      - path: /
        backend:
          serviceName: api
          servicePort: 3000

Leads to this errors on nginx logs:

conflicting server name "my.domain" on 0.0.0.0:80, ignored

"GET /.well-known/acme-challenge/AK94LF_RCdMq_yriPKU7IlAdxPclVzNmIAxpIfEkX-c HTTP/1.1" 404 209 "http://my.domain/.well-known/acme-challenge/AK94LF_RCdMq_yriPKU7IlAdxPclVzNmIAxpIfEkX-c" "Go-http-client/1.1" "-"

Nginx ingress docs:
https://github.com/nginxinc/kubernetes-ingress/tree/master/examples/mergeable-ingress-types

Which issue this PR fixes
#656

@jetstack-bot

Copy link
Copy Markdown
Contributor

@alepaez: Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

Details

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.

@jetstack-bot jetstack-bot added dco-signoff: no Indicates that at least one commit in this pull request is missing the DCO sign-off message. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. area/acme Indicates a PR directly modifies the ACME Issuer code labels Jun 14, 2019
@jetstack-bot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: alepaez
To fully approve this pull request, please assign additional approvers.
We suggest the following additional approver: munnerz

If they are not already assigned, you can assign the PR to them by writing /assign @munnerz in a comment when ready.

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@jetstack-bot jetstack-bot added the area/acme/http01 Indicates a PR modifies ACME HTTP01 provider code label Jun 14, 2019
@jetstack-bot
jetstack-bot requested a review from munnerz June 14, 2019 19:43
@jetstack-bot jetstack-bot added kind/documentation Categorizes issue or PR as related to documentation. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 14, 2019
@jetstack-bot

Copy link
Copy Markdown
Contributor

Hi @alepaez. Thanks for your PR.

I'm waiting for a jetstack or cert-manager member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

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.

@jetstack-bot jetstack-bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Jun 14, 2019
@alepaez
alepaez force-pushed the annotations_to_prevent_nginx_domain_conflict branch from 3435a71 to 057a139 Compare June 14, 2019 19:47
@jetstack-bot jetstack-bot added dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. and removed dco-signoff: no Indicates that at least one commit in this pull request is missing the DCO sign-off message. labels Jun 14, 2019
@zakkg3

zakkg3 commented Aug 14, 2019

Copy link
Copy Markdown

With another than nginx reverse proxy we need different annotations. we want traefik enforce ssl. This prevents the ACME challange to be solved. so I want here also:

traefik.ingress.kubernetes.io/frontend-entry-points: http

So maybe we want to read a key:value map from config file to add here.

@munnerz

munnerz commented Oct 16, 2019

Copy link
Copy Markdown
Member

I think this is a duplicate of #2023 which is looking at adding this in a more generic way 😄 thanks for the PR though! I believe #2023 should also satisfy @zakkg3's request too.

@munnerz munnerz closed this Oct 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/acme/http01 Indicates a PR modifies ACME HTTP01 provider code area/acme Indicates a PR directly modifies the ACME Issuer code dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. kind/documentation Categorizes issue or PR as related to documentation. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants