<p>All the deployments are running, all the pods are healthy. ingress-nginx is running. when I run <code>kubectl get ing</code>:</p>
<pre><code>NAME          CLASS    HOSTS       ADDRESS        PORTS   AGE
ingress-srv   &lt;none&gt;   myapp.com   192.168.49.2   80      13m
</code></pre>
<p>I set the hosts file for ingress.</p>
<p>this is the ingress-srv.yml</p>
<pre><code>apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ingress-srv
  annotations:
    kubernetes.io/ingress.class: &quot;nginx&quot;
    nginx.ingress.kubernetes.io/use-regex: &quot;true&quot;
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 // I tried &quot;Prefix&quot;
            backend:
              service:
                name: client-srv
                port:
                  number: 8080
</code></pre>
<p>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</p>
<pre><code>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
</code></pre>
<p>webpack config for client:</p>
<pre><code>module.exports = {
  mode: &quot;development&quot;,
  entry: [&quot;regenerator-runtime/runtime&quot;, &quot;./index.js&quot;],
  output: {
    path: path.resolve(__dirname, &quot;public&quot;),
    filename: &quot;main-bundle.js&quot;,
    publicPath: &quot;/&quot;,
  },
  module: {
    rules: [{ test: /\.js$/, loader: &quot;babel-loader&quot;, exclude: /node_modules/ }],
  },
  devtool: &quot;eval-cheap-source-map&quot;,
  devServer: {
    historyApiFallback: true,
    contentBase: path.resolve(__dirname, &quot;public&quot;),
    overlay: true,
  },
};
</code></pre>

Yilmaz
<p>First a word a caution: The webpack dev server is not intended to be used to serve the react app in production. You might want to investigate an alternative like nginx.</p>
<p>You get an error of <code>BadGateway</code> from your ingress. That means that the ingress recognizes the configuration, but can not reach the real service. Usually this is caused by a problem of the port mapping, but since you stated that you run the dev server with port 8080 and configured that in the kubernetes services as well, it should be fine.</p>
<p>I noticed that your deployment does not declare the port, this should be fixed:</p>
<pre><code>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
          ports:
          - containerPort: 8080
</code></pre>
<p>But there is one more thing to consider when listening for connections beside the port: The network interface to use. The webpack dev server is preconfigured to listen only on the loopback (localhost) interface and to not be available externally. It is a dev server after all.</p>
<p>This can be changed using a different listen address, either in the webpack configuration or on the command line:</p>
<pre><code>module.exports = {
  //...
  devServer: {
    host: '0.0.0.0'
  }
};
</code></pre>
<p>CLI: <code>webpack serve --host 0.0.0.0</code></p>
