2021年4月3日星期六

webpack react ingress-nginx kubernetes shows Bad Gateway

All the deployments are running, all the pods are healthy. ingress-nginx is running. when I run kubectl get ing:

NAME          CLASS    HOSTS       ADDRESS        PORTS   AGE  ingress-srv   <none>   myapp.com   192.168.49.2   80      13m  

I set the hosts file for ingress.

this is the ingress-srv.yml

apiVersion: networking.k8s.io/v1  kind: Ingress  metadata:    name: ingress-srv    annotations:      kubernetes.io/ingress.class: "nginx"      nginx.ingress.kubernetes.io/use-regex: "true"  spec:    defaultBackend:      service:        name: nginx-ingress-default-backend        port:          number: 80      rules:      - host: myapp.com        http:          paths:            - path: /posts              pathType: Exact              backend:                service:                  name: query-srv                  port:                    number: 4002            - path: /?(.*)              pathType: Exact              backend:                service:                  name: client-srv                  port:                    number: 8080  

the issue ingress api is not routing correctly. and react app is set up with webpack-dev-server. it's port is set to 8080. this is client-depl.yml

apiVersion: apps/v1  kind: Deployment  metadata:    name: client-depl  spec:    replicas: 1    selector:      matchLabels:        app: client    template:      metadata:        labels:          app: client      spec:        containers:          - name: client            image: kali/client  ---  apiVersion: v1  kind: Service  metadata:    name: client-srv  spec:    selector:      app: client    ports:      - name: client        protocol: TCP        port: 8080        targetPort: 8080  
https://stackoverflow.com/questions/66937713/webpack-react-ingress-nginx-kubernetes-shows-bad-gateway April 04, 2021 at 11:13AM

没有评论:

发表评论