error when creating "STDIN": Internal error occurred while running skaffold dev
Asked Answered
P

2

1

So, I'm using minikube v1.19.0 in ubuntu and using nginx-ingress with kubernetes. I have two node files: auth and client having docker image made respectively

i got 4 kubernetes cinfig files which are as follows:

auth-deply.yaml:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: auth-depl
spec:
  replicas: 1
  selector:
    matchLabels:
      app: auth
  template:
    metadata:
      labels:
        app: auth
    spec:
      containers:
        - name: auth
          image: xyz/auth
          env:
            - name: JWT_KEY
              valueFrom:
                secretKeyRef:
                  name: jwt-secret
                  key: JWT_KEY
---
apiVersion: v1
kind: Service
metadata:
  name: auth-srv
spec:
  selector:
    app: auth
  ports:
    - name: auth
      protocol: TCP
      port: 3000
      targetPort: 3000

auth-moongo-depl.yaml:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: auth-mongo-depl
spec:
  selector:
    matchLabels:
      app: auth-mongo
  template:
    metadata:
      labels:
        app: auth-mongo
    spec:
      containers:
      - name: auth-mongo
        image: mongo
---
apiVersion: v1
kind: Service
metadata:
  name: auth-mongo-srv
spec:
  selector:
    app: auth-mongo
  ports:
    - name: db
      protocol: TCP
      port: 27017
      targetPort: 27017

client-depl.yaml:

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: xyz/client
---
apiVersion: v1
kind: Service
metadata:
  name: client-srv
spec:
  selector:
    app: client
  ports:
    - name: client
      protocol: TCP
      port: 3000
      targetPort: 3000

ingress-srv.yaml:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: ingress-service
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/use-regex: 'true'
spec:
  rules:
    - host: ticketing.dev
      http:
        paths:
          - path: /api/users/?(.*)
            backend:
              serviceName: auth-srv
              servicePort: 3000
          - path: /?(.*)
            backend:
              serviceName: client-srv
              servicePort: 3000

skaffold.yaml:

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

Now, when I run skaffold dev the following error is coming:

Listing files to watch...
 - xyz/auth
 - xyz/client
Generating tags...
 - xyz/auth -> xyz/auth:abcb6e4
 - xyz/client -> xyz/client:abcb6e4
Checking cache...
 - xyz/auth: Found Locally
 - xyz/client: Found Locally
Starting test...
Tags used in deployment:
 - xyz/auth -> xyz/auth:370487d5c0136906178e602b3548ddba9db75106b22a1af238e02ed950ec3f21
 - xyz/client -> xyz/client:a56ea90769d6f31e983a42e1c52275b8ea2480cb8905bf19b08738e0c34eafd3
Starting deploy...
 - deployment.apps/auth-depl configured
 - service/auth-srv configured
 - deployment.apps/auth-mongo-depl configured
 - service/auth-mongo-srv configured
 - deployment.apps/client-depl configured
 - service/client-srv configured
 - Warning: extensions/v1beta1 Ingress is deprecated in v1.14+, unavailable in v1.22+; use networking.k8s.io/v1 Ingress
 - Error from server (InternalError): error when creating "STDIN": Internal error occurred: failed calling webhook "validate.nginx.ingress.kubernetes.io": an error on the server ("") has prevented the request from succeeding
exiting dev mode because first deploy failed: kubectl apply: exit status 1

Actually everything was working fine until i reinstall minikube again and getting this problem. Need some help here.

Providenciaprovident answered 22/4, 2021 at 11:59 Comment(2)
minikube version got changed ?Knock
check the ingress version with kubectl get ingress and also check the version of Kubernetes cluster and which API cluster is supporting.Knock
P
3

Actually I just found out the issue was when reinstalling the minikube, Validating Webhook was not deleted and creating the issue hence, should be removed using following command.

kubectl delete -A ValidatingWebhookConfiguration ingress-nginx-admission

I found out that while reinstalling i forgot to remove this webhook that is installed in the manifests which created this problem.

Additional links related to this problem:

Nginx Ingress: service "ingress-nginx-controller-admission" not found

Nginx Ingress Controller - Failed Calling Webhook

Providenciaprovident answered 22/4, 2021 at 12:49 Comment(0)
K
0

Your logs are clearly saying there is an issue with the ingress version warning.

Warning: extensions/v1beta1 Ingress is deprecated in v1.14+, unavailable in v1.22+; use networking.k8s.io/v1 Ingress

your cluster version might be above the 1.14+

it might be a possible version of your minikube got updated

example latest ingress

apiVersion: "networking.k8s.io/v1beta1"
kind: "Ingress"
metadata:
  name: "example-ingress"
spec:
  ingressClassName: "external-lb"
  rules:
  - host: "*.example.com"
    http:
      paths:
      - path: "/example"
        pathType: "Prefix"
        backend:
          serviceName: "example-service"
          servicePort: 80

lastet ingress apiversion is : networking.k8s.io/v1beta1 you can check the version of your lubernetes cluster and verify which API cluster is supporting.

https://kubernetes.io/blog/2020/04/02/improvements-to-the-ingress-api-in-kubernetes-1.18/

To check which API version your Kubernetes supporting you can run :

kubectl api-versions
Knock answered 22/4, 2021 at 12:25 Comment(1)
Thank bro for your help but the issue was in webhook which I later on fixed it. Btw thank you so much for providing knowledge about kubernetes api-versionsProvidenciaprovident

© 2022 - 2024 — McMap. All rights reserved.