Skip to content

NimTechnology

Trình bày các công nghệ CLOUD một cách dễ hiểu.

  • Kubernetes & Container
    • Docker
    • Kubernetes
      • Ingress
      • Pod
    • Helm Chart
    • OAuth2 Proxy
    • Isito-EnvoyFilter
    • Apache Kafka
      • Kafka
      • Kafka Connect
      • Lenses
    • Vault
    • Longhorn – Storage
    • VictoriaMetrics
    • MetalLB
    • Kong Gateway
  • CI/CD
    • ArgoCD
    • ArgoWorkflows
    • Argo Events
    • Spinnaker
    • Jenkins
    • Harbor
    • TeamCity
    • Git
      • Bitbucket
  • Coding
    • DevSecOps
    • Terraform
      • GCP – Google Cloud
      • AWS – Amazon Web Service
      • Azure Cloud
    • Golang
    • Laravel
    • Python
    • Jquery & JavaScript
    • Selenium
  • Log, Monitor & Tracing
    • DataDog
    • Prometheus
    • Grafana
    • ELK
      • Kibana
      • Logstash
  • BareMetal
    • NextCloud
  • Toggle search form

[Ingress-nginx] Snippet directives are disabled by the Ingress administrator

Posted on March 5, 2024 By nim No Comments on [Ingress-nginx] Snippet directives are disabled by the Ingress administrator

Mình đã gặp lỗi biên dưới khi apply ingress nginx configuration.


admission webhook "validate.nginx.ingress.kubernetes.io" denied the request: nginx.ingress.kubernetes.io/configuration-snippet annotation cannot be used. Snippet directives are disabled by the Ingress administrator

Ingress có config như sau:
và lỗi có liên quan đến nginx.ingress.kubernetes.io/configuration-snippet

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    cert-manager.io/issuer: hubble
    cert-manager.io/issuer-kind: Issuer
    nginx.ingress.kubernetes.io/auth-signin: https://$host/oauth2/start?rd=$escaped_request_uri
    nginx.ingress.kubernetes.io/auth-url: https://$host/oauth2/auth
    nginx.ingress.kubernetes.io/configuration-snippet: |
      proxy_set_header Origin "";
      proxy_hide_header l5d-remote-ip;
      proxy_hide_header l5d-server-id;
    nginx.ingress.kubernetes.io/proxy-buffer-size: 8k
    nginx.ingress.kubernetes.io/proxy-buffering: "on"
    #nginx.ingress.kubernetes.io/upstream-vhost: $service_name.$namespace.svc.cluster.local:80
  managedFields:
  name: ingress-hubble
  namespace: kube-system
spec:
  ingressClassName: nginx
  rules:
  - host: hubble.nimtechnology.com
    http:
      paths:
      - backend:
          service:
            name: hubble-ui
            port:
              number: 80
        path: /
        pathType: Prefix
  tls:
  - hosts:
    - hubble.nimtechnology.com
    secretName: tls-hubble-ingress

Vậy nginx.ingress.kubernetes.io/configuration-snippet dùng để làm gì:

is an annotation used in Kubernetes Ingress objects, particularly with the NGINX Ingress Controller. This annotation allows you to inject additional NGINX configuration into the server or location block generated for the Ingress. This can be used to customize the behavior of NGINX in handling requests for the service defined in the Ingress.

This snippet has the following effects:

  1. proxy_set_header Origin "";: This line sets the Origin header to an empty string. In a typical proxy setting, the Origin header indicates the origin of the request. By setting it to an empty string, this can modify cross-origin resource sharing (CORS) behavior, potentially bypassing checks that rely on the Origin header.
  2. proxy_hide_header l5d-remote-ip;: This line instructs NGINX to remove the l5d-remote-ip header from the response before sending it to the client. This header is typically set by Linkerd, a service mesh, to indicate the original IP address of the client. Hiding this header can be used for privacy reasons or to prevent the downstream client from seeing internal network details.
  3. proxy_hide_header l5d-server-id;: Similar to the previous line, this instruction removes the l5d-server-id header from the response. This header usually contains the identity of the Linkerd instance handling the request, and hiding it can again be for privacy or security reasons, preventing external users from gaining information about the internal service architecture.

Enable Snippet Configuration on Ingress Nginx.

Nếu bạn bắt buộc phải sài cái : nginx.ingress.kubernetes.io/configuration-snippet thì làm sao đây

Mình có tìm được 1 issue liên quan đến disable snippet là default:
https://github.com/kubernetes/ingress-nginx/issues/10543#issuecomment-1773483812

Đây là pull request về việc họ đã –> allow-snippet-annotations – should be disabled by default – Disable user snippets per default #10393

Nếu bạn muốn enable thì bạn có thể thêm trong helm value:
controller.allowSnippetAnnotations: true

Ingress

Post navigation

Previous Post: Message Prioritization in Kafka
Next Post: [Azure] How to generate Access Token and Refresh Token of Azure.

More Related Articles

[GRPC/Golang] Learning GRPC and Golang through the easy and actual lessons. Golang
Hướng dẫn sử dụng ingress nginx và control ingress bằng annotations trên k8s Ingress
[Metallb] Create LoadBalancer Service on K8S (on-premise) so easily Ingress
[Ingress Nginx/MetalLB] Install Ingress Nginx trên K8s bằng helm Ingress
[ingress-nginx] ingress /contains invalid path Ingress
[ingress-nginx] Error=”ingress does not contain a valid IngressClass”, After upgrade ingress-nginx(helm 4.x.x, ingress-nginx/controller:v1.1.0) Ingress

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Tham Gia Group DevOps nhé!
Để Nim có nhiều động lực ra nhiều bài viết.
Để nhận được những thông báo mới nhất.

Recent Posts

  • [Laravel] Laravel Helpful June 26, 2025
  • [VScode] Hướng dẫn điều chỉnh font cho terminal June 20, 2025
  • [WordPress] Hướng dấn gửi mail trên WordPress thông qua gmail. June 15, 2025
  • [Bitbucket] Git Clone/Pull/Push with Bitbucket through API Token. June 12, 2025
  • [Teamcity] How to transfer the value from pipeline A to pipeline B June 9, 2025

Archives

  • June 2025
  • May 2025
  • April 2025
  • March 2025
  • February 2025
  • January 2025
  • December 2024
  • November 2024
  • October 2024
  • September 2024
  • August 2024
  • July 2024
  • June 2024
  • May 2024
  • April 2024
  • March 2024
  • February 2024
  • January 2024
  • December 2023
  • November 2023
  • October 2023
  • September 2023
  • August 2023
  • July 2023
  • June 2023
  • May 2023
  • April 2023
  • March 2023
  • February 2023
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • August 2022
  • July 2022
  • June 2022
  • May 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021

Categories

  • BareMetal
    • NextCloud
  • CI/CD
    • Argo Events
    • ArgoCD
    • ArgoWorkflows
    • Git
      • Bitbucket
    • Harbor
    • Jenkins
    • Spinnaker
    • TeamCity
  • Coding
    • DevSecOps
    • Golang
    • Jquery & JavaScript
    • Laravel
    • NextJS 14 & ReactJS & Type Script
    • Python
    • Selenium
    • Terraform
      • AWS – Amazon Web Service
      • Azure Cloud
      • GCP – Google Cloud
  • Kubernetes & Container
    • Apache Kafka
      • Kafka
      • Kafka Connect
      • Lenses
    • Docker
    • Helm Chart
    • Isito-EnvoyFilter
    • Kong Gateway
    • Kubernetes
      • Ingress
      • Pod
    • Longhorn – Storage
    • MetalLB
    • OAuth2 Proxy
    • Vault
    • VictoriaMetrics
  • Log, Monitor & Tracing
    • DataDog
    • ELK
      • Kibana
      • Logstash
    • Fluent
    • Grafana
    • Prometheus
  • Uncategorized
  • Admin

Copyright © 2025 NimTechnology.