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

[server-snippet]nginx: [emerg] duplicate location "/" in /tmp/nginx/nginx-cfg #8746

Closed
liu-xuewen opened this issue Jun 27, 2022 · 9 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.

Comments

@liu-xuewen
Copy link

What happened:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    nginx.ingress.kubernetes.io/server-snippet: |
        location / {
      	  return 200;
        }
# nginx
2022/06/27 06:24:14 [emerg] 348#348: duplicate location "/" in /tmp/nginx/nginx-cfg5348903:698
nginx: [emerg] duplicate location "/" in /tmp/nginx/nginx-cfg5348903:698
nginx: configuration file /tmp/nginx/nginx-cfg5348903 test failed

image

What you expected to happen:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    nginx.ingress.kubernetes.io/server-no-root-location: true
    nginx.ingress.kubernetes.io/server-snippet: |
        location / {
      	  root /data/dist;
          index index.html;
        }

success

need add server-no-root-location to enable server-snippet to configure root location

NGINX Ingress controller version (exec into the pod and run nginx-ingress-controller --version.):

Kubernetes version (use kubectl version):

Environment:

  • Cloud provider or hardware configuration:

  • OS (e.g. from /etc/os-release):

  • Kernel (e.g. uname -a):

  • Install tools:

    • Please mention how/where was the cluster created like kubeadm/kops/minikube/kind etc.
  • Basic cluster related info:

    • kubectl version
    • kubectl get nodes -o wide
  • How was the ingress-nginx-controller installed:

    • If helm was used then please show output of helm ls -A | grep -i ingress
    • If helm was used then please show output of helm -n <ingresscontrollernamepspace> get values <helmreleasename>
    • If helm was not used, then copy/paste the complete precise command used to install the controller, along with the flags and options used
    • if you have more than one instance of the ingress-nginx-controller installed in the same cluster, please provide details for all the instances
  • Current State of the controller:

    • kubectl describe ingressclasses
    • kubectl -n <ingresscontrollernamespace> get all -A -o wide
    • kubectl -n <ingresscontrollernamespace> describe po <ingresscontrollerpodname>
    • kubectl -n <ingresscontrollernamespace> describe svc <ingresscontrollerservicename>
  • Current state of ingress object, if applicable:

    • kubectl -n <appnnamespace> get all,ing -o wide
    • kubectl -n <appnamespace> describe ing <ingressname>
    • If applicable, then, your complete and exact curl/grpcurl command (redacted if required) and the reponse to the curl/grpcurl command with the -v flag
  • Others:

    • Any other related information like ;
      • copy/paste of the snippet (if applicable)
      • kubectl describe ... of any custom configmap(s) created and in use
      • Any other related information that may help

How to reproduce this issue:

Anything else we need to know:

@liu-xuewen liu-xuewen added the kind/bug Categorizes issue or PR as related to a bug. label Jun 27, 2022
@k8s-ci-robot
Copy link
Contributor

@liu-xuewen: 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.

@k8s-ci-robot k8s-ci-robot added needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority labels Jun 27, 2022
@longwuyuan
Copy link
Contributor

/remove-kind bug

Try to post information asked in the template and provide details of what problem needs to be solved.

@k8s-ci-robot k8s-ci-robot added 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 Jun 27, 2022
@bmv126
Copy link

bmv126 commented Jun 27, 2022

Root directive support is removed in latest version
#8624 (comment)

@tao12345666333
Copy link
Member

Root directive support is removed in latest version

#8624 (comment)

yes.

So this is expected behavior. I think we can close it

@longwuyuan
Copy link
Contributor

/close

@k8s-ci-robot
Copy link
Contributor

@longwuyuan: Closing this issue.

In response to this:

/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.

@BloodyIron
Copy link

So we can't even ever modify "location /" declarations for a specific already existing server block? I want to add (without malicious intent) declarations to that, and this is blocking me from doing it! I may have to spin up my own nginx pod just to get around this... There's no way to add/modify any declarations for "location /" in each server block hey? :(

@Aboitier
Copy link

I am also curious about this. I am trying to modify the server-snippet for the ingress of one of my apps. Turns out I might have to go into the nginx.conf inside the nginx-controller pods to modify it (without persistence...).
Please provide a manner to modify "location /" from the ingress.yaml file.

@BloodyIron
Copy link

I am also curious about this. I am trying to modify the server-snippet for the ingress of one of my apps. Turns out I might have to go into the nginx.conf inside the nginx-controller pods to modify it (without persistence...). Please provide a manner to modify "location /" from the ingress.yaml file.

Perhaps you might more mean the "kind: Ingress" aspect? :)

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.
Projects
None yet
Development

No branches or pull requests

7 participants