skip to Main Content

Building a Microservices app(Node/React) with docker and kubernetes and I keep getting the following error when I run the skaffold dev command.

- stderr: "error: unable to recognize ~/infra/k8s/ingress-srv.yaml": no matches for kind "Ingress" in version "extensions/v1beta1"n"

This is my ingress-srv.yaml file:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: ingress-serv
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/use-regex: "true"
spec:
  rules:
    - host: ticketing.dev
      http:
        paths:
          - pathType: Prefix
          - path: "/api/users/?(.*)"
            backend:
              service:
                name: auth-srv
                port:
                  number: 3000

And this is my skaffold.yaml file

apiVersion: skaffold/v2alpha3
kind: Config
deploy:
  kubectl:
    manifests:
      - ./infra/k8s/*
build:
  local:
    push: false
  artifacts: 
    - image: mutuadocker/auth
      context: auth
      docker:
        dockerfile: Dockerfile
      sync: 
        manual: 
          - src: "src/**/*.ts"
            dest: .

2

Answers


  1. You should change apiVersion: extensions/v1beta1 to apiVersion: networking.k8s.io/v1
    so your file would look like this:

    apiVersion: networking.k8s.io/v1
    kind: Ingress
    metadata:
      name: ingress-serv
      annotations:
        kubernetes.io/ingress.class: nginx
        nginx.ingress.kubernetes.io/use-regex: "true"
    spec:
      rules:
        - host: ticketing.dev
          http:
            paths:
              - pathType: Prefix
              - path: "/api/users/?(.*)"
                backend:
                  service:
                    name: auth-srv
                    port:
                      number: 3000
    

    Refer to this documentation.

    Login or Signup to reply.
  2. I know this question is partly old but…
    Here’s my answer.

    Make sure the pathType is inside the paths array; not outside it and not as a standalone array

    apiVersion: networking.k8s.io/v1
    kind: Ingress
    metadata:
      name: ingress-serv
      annotations:
      kubernetes.io/ingress.class: nginx
        nginx.ingress.kubernetes.io/use-regex: "true"
    spec:
      rules:
        - host: ticketing.dev
          http:
            paths:
              - path: "/api/users/?(.*)"
                pathType: Prefix
                backend:
                  service:
                    name: auth-srv
                    port:
                      number: 3000
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search