I am completely stuck when trying to run skaffold on my project. It keeps throwing an error when run from the ingress srv

Viewed 206

When I run skaffold this is the error I get. Skaffold generates tags, checks the cache, starts the deploy then it cleans up.

- stderr: "error: error parsing C: ~\k8s\\ingress-srv.yaml: error converting YAML to JSON: yaml: line 20: mapping values are not allowed in this context
\n"
 - cause: exit status 1

Docker creates a container for the server. Here is the ingress server yaml file:

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

For good measure here is the skaffold file:

apiVersion: skaffold/v2alpha3
kind: Config
deploy:
  kubectl:
    manifests:
      - ./infra/k8s/*
build:
  local:
    push: false
  artifacts:
    - image: giantgecko/auth
      context: auth
      docker:
        dockerfile: Dockerfile
      sync:
        manual:
          - src: 'src/**/*.ts'
            dest: .
    - image: giantgecko/front-end
      context: front-end
      docker:
        dockerfile: Dockerfile
      sync:
        manual:
          - src: '**/*.js'
            dest: .
1 Answers

Take a closer look at your Ingress definition file (starting from line 19):

- path: /?(.*)
    pathType: Prefix
    backend:
      service:
        name: front-end-srv
        port:
          number: 3000

You have unnecessary indents from the line 20 (pathType: Prefix) till the end of the file. Just format your YAML file properly. For the previous path: /api/users/?(.*) everything is alright - no unnecessary indents.

Final YAML looks like this:

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