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

GKE Nginx Value Issue #123

Open
otavioss opened this issue May 15, 2024 · 1 comment
Open

GKE Nginx Value Issue #123

otavioss opened this issue May 15, 2024 · 1 comment

Comments

@otavioss
Copy link

The ingress generated by GKE recommended values does not work, and that server-snippet is too complex and causes a lot of intermittent 404:

nginx.ingress.kubernetes.io/server-snippet: |
client_max_body_size 200m;
{{- if eq .Release.Namespace "default" }}
set $bold_namespace "{{ .Values.namespace }}";
{{- else }}
set $bold_namespace "{{ .Release.Namespace }}";
{{- end }}
location ~* "^/bi/api(/|$)(.*)" {

The helm template does not allow changing the ingress class:

kubernetes.io/ingress.class: "nginx"

{{- if and $ingressSupportsIngressClassName .Values.loadBalancer.ingressClassName }}
ingressClassName: {{ .Values.loadBalancer.ingressClassName }}
{{- end }}

Here is a sample of a ingress that works

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: bold-ingress-
  namespace: bold-bi
  annotations:
    nginx.ingress.kubernetes.io/affinity: cookie
    nginx.ingress.kubernetes.io/session-cookie-hash: sha1
    nginx.ingress.kubernetes.io/session-cookie-name: "bold.k8s.pod.id"
    nginx.ingress.kubernetes.io/session-cookie-max-age: '600'
    nginx.ingress.kubernetes.io/use-regex: 'true'
    nginx.ingress.kubernetes.io/proxy-buffer-size: "128k"
    nginx.ingress.kubernetes.io/proxy-buffers: "256k"
    nginx.ingress.kubernetes.io/proxy-busy-buffers-size: "256k"
    nginx.ingress.kubernetes.io/large-client-header-buffers: "16k"
    nginx.ingress.kubernetes.io/fastcgi-buffers: "16k"
    nginx.ingress.kubernetes.io/fastcgi-buffer-size: "32k"
    nginx.ingress.kubernetes.io/proxy-connect-timeout: "300"
    nginx.ingress.kubernetes.io/proxy-read-timeout: "300"
    nginx.ingress.kubernetes.io/proxy-send-timeout: "300"
spec:
  ingressClassName: example
  tls:
  - hosts:
    - bold-bi.example.com
    - www.bold-bi.example.com
    secretName: bold-bi-tls
  rules:
  - host: bold-bi.example.com
    http:
      paths:
      - path: "/bi/api/*"
        pathType: ImplementationSpecific
        backend:
          service:
            name: bi-api-service
            port:
              number: 6005
      - path: "/bi/jobs/*"
        pathType: ImplementationSpecific
        backend:
          service:
            name: bi-jobs-service
            port:
              number: 6006
      - path: "/bi/designer/*"
        pathType: ImplementationSpecific
        backend:
          service:
            name: bi-dataservice-service
            port:
              number: 6007
      - path: "/bi/*"
        pathType: ImplementationSpecific
        backend:
          service:
            name: bi-web-service
            port:
              number: 6004
      - path: "/api/*"
        pathType: ImplementationSpecific
        backend:
          service:
            name: id-api-service
            port:
              number: 6001
      - path: "/ums/*"
        pathType: ImplementationSpecific
        backend:
          service:
            name: id-ums-service
            port:
              number: 6002
      - path: "/*"
        pathType: ImplementationSpecific
        backend:
          service:
            name: id-web-service
            port:
              number: 6000

The ETL service needs to be created separately due to the rewrite target, if added together the application will return 502:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
 name: bold-ingress-etl
 namespace: bold-bi
 annotations:
   nginx.ingress.kubernetes.io/affinity: cookie
   nginx.ingress.kubernetes.io/session-cookie-hash: sha1
   nginx.ingress.kubernetes.io/session-cookie-name: "bold.k8s.pod.id"
   nginx.ingress.kubernetes.io/session-cookie-max-age: '600'
   nginx.ingress.kubernetes.io/use-regex: 'true'
   nginx.ingress.kubernetes.io/proxy-buffer-size: "128k"
   nginx.ingress.kubernetes.io/proxy-buffers: "256k"
   nginx.ingress.kubernetes.io/proxy-busy-buffers-size: "256k"
   nginx.ingress.kubernetes.io/large-client-header-buffers: "16k"
   nginx.ingress.kubernetes.io/fastcgi-buffers: "16k"
   nginx.ingress.kubernetes.io/fastcgi-buffer-size: "32k"
   nginx.ingress.kubernetes.io/proxy-connect-timeout: "300"
   nginx.ingress.kubernetes.io/proxy-read-timeout: "300"
   nginx.ingress.kubernetes.io/proxy-send-timeout: "300"
   nginx.ingress.kubernetes.io/rewrite-target: /$2
spec:
 ingressClassName: example
 tls:
 - hosts:
   - bold-bi.example.com
   - www.bold-bi.example.com
   secretName: bold-bi-tls
 rules:
 - host: bold-bi.example.com
   http:
     paths:
     - path: "/etlservice(/|$)(.*)"
       pathType: ImplementationSpecific
       backend:
         service:
           name: bold-etl-service
           port:
             number: 6009
@sivakumar-devops
Copy link
Contributor

Hi @otavioss,
Currently, we are addressing the concerns regarding the nginx Ingress file. We will update you once we have completed the changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants