admin管理员组

文章数量:1392002

I have a web application running on kubernetes cluster. There are some cookies on the frontend part and I want to add this cookies in the request header. I'm using axios for sending request. I added withCredentials: true to axios instance. In the backend there is node.js. I added app.use(cors({origin: true, credentials: true})); middleware. When I run the app locally, frontend part is sending the cookies I can see it on the network tab. So I assume that I need to do some modification in kubernetes ingress. Here is my kubernetes ingress for backend and frontend:

Frontend:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: client-ingress
  namespace: {{ .Values.namespace }}
  annotations:
    cert-manager.io/cluster-issuer: letsencrypt
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  ingressClassName: nginx
  tls:
    - hosts:
        - {{ .Values.ingress.hostname }}
      secretName: {{ .Values.frontend.name }}-tls
  rules:
  - host: {{ .Values.ingress.hostname }}
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: client-cluster-ip-service
            port:
              number: 5000

Backend:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: server-ingress
  namespace: {{ .Values.namespace }}
  annotations:
    cert-manager.io/cluster-issuer: letsencrypt
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  ingressClassName: nginx
  tls: 
    - hosts:
        - {{ .Values.ingress.hostname }}
      secretName: {{ .Values.backend.name }}-tls
  rules:
  - host: {{ .Values.ingress.hostname }}
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: server-cluster-ip-service
            port:
              number: 8000

What can I do? Do you think I need to add something to this ingress? Or do you think problem is something else?

本文标签: nodejsHow to modify Kubernetes ingress for sending cookieStack Overflow