<p>I've been toying with DevSpace with Helm charts and possibly migrating to it from Skaffold and Kubernetes manifests. I can't seem to get the ingress controller working for local development: comes back with <code>404 Not Found</code>. I can reach it via port-forwarding, however, at <code>localhost:3000</code>.</p>
<p>Like I've always done, I <a href="https://kubernetes.github.io/ingress-nginx/deploy/#docker-desktop" rel="nofollow noreferrer">installed the <code>ingress-nginx</code> controller</a> first for <code>docker-desktop</code> with:</p>
<pre><code>kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.0.0/deploy/static/provider/cloud/deploy.yaml
</code></pre>
<p>Then in my <code>devspace.yaml</code> I have the following:</p>
<pre><code>version: v1beta10

images:
  client:
    image: app/client
    dockerfile: client/Dockerfile
    context: client/

deployments:
- name: client
  helm:
    componentChart: true
    values:
      containers:
      - image: app/client
      service:
        ports:
          - port: 3000
      ingress:
        name: ingress
        rules: 
        - host: localhost
          path: /
          pathType: Prefix
          servicePort: 3000
          serviceName: client
dev:
  ports:
  - name: client
    imageSelector: app/client
    forward:
    - port: 3000
      remotePort: 3000
  sync:
  - name: client
    imageSelector: app/client
    localSubPath: ./client
    excludePaths: 
    - .git/
    - node_modules/
</code></pre>
<p>The <code>Dockerfile</code> is the same for both configurations.</p>
<pre><code>FROM node:14-alpine
WORKDIR /app
COPY ./package.json ./
ENV CI=true
RUN npm install
COPY . .
EXPOSE 3000
CMD [&quot;npm&quot;, &quot;start&quot;]
</code></pre>
<p>Furthermore, I've noticed as I add services (e.g. <code>/api</code>, <code>/admin</code>, etc.) with corresponding <code>ingress.rules</code>, it creates as an ingress for each service instead of just one for the entire application.</p>
<p>For reference, this is what I used to do with <code>skaffold</code> and manifests:</p>
<pre><code># ingress.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    kubernetes.io/ingress.class: &quot;nginx&quot;
  name: ingress-dev
spec:
  rules:
    - host: localhost
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: client-cluster-ip-service-dev
                port:
                  number: 3000
</code></pre>
<pre><code># client.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: client-deployment-dev
spec:
  replicas: 1
  revisionHistoryLimit: 5
  selector:
    matchLabels:
      component: client
      environment: development
  template:
    metadata:
      labels:
        component: client
        environment: development
    spec:
      containers:
        - name: client
          image: client
          ports:
            - containerPort: 3000
---
apiVersion: v1
kind: Service
metadata:
  name: client-cluster-ip-service-dev
spec:
  type: ClusterIP
  selector:
    component: client
    environment: development
  ports:
    - port: 3000
      targetPort: 3000
</code></pre>
<pre><code># skaffold.yaml
apiVersion: skaffold/v2beta1
kind: Config
build:
  artifacts:
  - image: client
    context: client
    sync:
      manual:
      - src: 'src/**/*.js'
        dest: .
      - src: 'src/**/*.jsx'
        dest: .
      - src: 'package.json'
        dest: .
      - src: 'public/**/*.html'
        dest: .
      - src: 'src/assets/sass/**/*.scss'
        dest: .
      - src: 'src/build/**/*.js'
        dest: .
    docker:
      dockerfile: Dockerfile.dev
  local:
    push: false
deploy:
  kubectl:
    manifests:
      - k8s/ingress.yaml 
      - k8s/client.yaml
</code></pre>
<p>I prefer using the <code>ingress</code> controller during development instead of port-forwarding. That way I can I just go to <code>localhost/</code>, <code>localhost/admin</code>, <code>localhost/api</code>, etc. I've run into serious bugs before that didn't come up using port-forwarding, but do with the ingress controller, so I just don't trust it.</p>
<p>Any suggestions for:</p>
<ol>
<li>Getting the ingress working so that it is reaching the service?</li>
<li>Setting up the <code>devspace.yaml</code> so that it creates one ingress instead of one for each service?</li>
</ol>
<hr />
<p>The <code>devspace render</code>:</p>
<pre><code>---
# Source: component-chart/templates/service.yaml
apiVersion: v1
kind: Service
metadata:
  name: &quot;client&quot;
  labels:
    &quot;app.kubernetes.io/name&quot;: &quot;client&quot;
    &quot;app.kubernetes.io/managed-by&quot;: &quot;Helm&quot;
  annotations:
    &quot;helm.sh/chart&quot;: &quot;component-chart-0.8.2&quot;
spec:
  externalIPs:
  ports:
    - name: &quot;port-0&quot;
      port: 3000
      targetPort: 3000
      protocol: &quot;TCP&quot;
  selector:
    &quot;app.kubernetes.io/name&quot;: &quot;devspace-app&quot;
    &quot;app.kubernetes.io/component&quot;: &quot;client&quot;
  type: &quot;ClusterIP&quot;
---
# Source: component-chart/templates/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: &quot;client&quot;
  labels:
    &quot;app.kubernetes.io/name&quot;: &quot;devspace-app&quot;
    &quot;app.kubernetes.io/component&quot;: &quot;client&quot;
    &quot;app.kubernetes.io/managed-by&quot;: &quot;Helm&quot;
  annotations:
    &quot;helm.sh/chart&quot;: &quot;component-chart-0.8.2&quot;
spec:
  replicas: 1
  strategy:
    type: Recreate
  selector:
    matchLabels:
      &quot;app.kubernetes.io/name&quot;: &quot;devspace-app&quot;
      &quot;app.kubernetes.io/component&quot;: &quot;client&quot;
      &quot;app.kubernetes.io/managed-by&quot;: &quot;Helm&quot;
  template:
    metadata:
      labels:
        &quot;app.kubernetes.io/name&quot;: &quot;devspace-app&quot;
        &quot;app.kubernetes.io/component&quot;: &quot;client&quot;
        &quot;app.kubernetes.io/managed-by&quot;: &quot;Helm&quot;
      annotations:
        &quot;helm.sh/chart&quot;: &quot;component-chart-0.8.2&quot;
    spec:
      imagePullSecrets:
      nodeSelector:
        null
      nodeName:
        null
      affinity:
        null
      tolerations:
        null
      dnsConfig:
        null
      hostAliases:
        null
      overhead:
        null
      readinessGates:
        null
      securityContext:
        null
      topologySpreadConstraints:
        null
      terminationGracePeriodSeconds: 5
      ephemeralContainers:
        null
      containers:
        - image: &quot;croner-app/client:AtrvTRR&quot;
          name: &quot;container-0&quot;
          command:
          args:
          env:
            null
          envFrom:
            null
          securityContext:
            null
          lifecycle:
            null
          livenessProbe:
            null
          readinessProbe:
            null
          startupProbe:
            null
          volumeDevices:
            null
          volumeMounts:
      initContainers:
      volumes:
  volumeClaimTemplates:
---
# Source: component-chart/templates/ingress.yaml
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: &quot;ingress&quot;
  labels:
    &quot;app.kubernetes.io/name&quot;: &quot;client&quot;
    &quot;app.kubernetes.io/managed-by&quot;: &quot;Helm&quot;
  annotations:
    &quot;helm.sh/chart&quot;: &quot;component-chart-0.8.2&quot;
spec:
  rules:
  - host: &quot;localhost&quot;
    http:
      paths:
      - backend:
          serviceName: client
          servicePort: 3000
        path: &quot;/&quot;
        pathType: &quot;Prefix&quot;
---
</code></pre>
<p>The biggest difference I can see is what I used to use is <code>apiVersion: networking.k8s.io/v1</code> and the <code>devspace</code> one is <code>apiVersion: extensions/v1beta1</code>. Perhaps the ingress controller <code>controller-v1.0.0</code> I'm applying isn't compatible? Not sure...</p>

cjones
<p>In this particular case, the solution was to use an older version of the <code>ingress-nginx</code> controller that is compatible with the version used by DevSpace. In my case, I was using <code>devspace v5.16.0-alpha.0</code> and the following controller works with it:</p>
<pre><code>kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v0.49.0/deploy/static/provider/cloud/deploy.yaml
</code></pre>
<p>Since this solution will change with newer versions of <code>devspace</code> and <code>ingress-nginx</code>, in general:</p>
<ul>
<li>Make sure the <code>ingress-nginx</code> controller version and the <code>devspace</code> version are compatible.</li>
<li>Check <code>devspace render</code> to see how ingress config is being generated and that the <code>apiVersion</code> is compatible with ingress controller version you <code>kubectl apply</code>.</li>
</ul>
