3

I am on Kubernetes v1.22.13. When i was trying to delete a namespace that's stuck in status terminating, i deleted api-service v1.networking.k8s.io by mistake with:

kubectl delete apiservices.apiregistration.k8s.io v1.networking.k8s.io

And now i don't have crds related to v1.networking.k8s.io such as Ingress. When i try to install ingress-controller it gives the error:

error: resource mapping not found for name: "nginx" namespace: "" from "https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.4.0/deploy/static/provider/cloud/deploy.yaml": no matches for kind "IngressClass" in version "networking.k8s.io/v1"

How can i undo that operation? Or how can i bring back api-resource v1.networking.k8s.io?

Tried to find a way to undo it and install it manually but i couldn't find the manifest related to that.

miador
  • 358
  • 1
  • 5
  • 20

1 Answers1

2

You can recreate it via the following:

cat <<EOF | kubectl apply -f -
apiVersion: apiregistration.k8s.io/v1
kind: APIService
metadata:
  labels:
    kube-aggregator.kubernetes.io/automanaged: onstart
  name: v1.networking.k8s.io
spec:
  group: networking.k8s.io
  groupPriorityMinimum: 17200
  version: v1
  versionPriority: 15
EOF
chresse
  • 5,486
  • 3
  • 30
  • 47
  • Thanks! I guess this yaml is taken from working k8s deployment , but is there option to regenerate it on the fly from some original repo or recover internally considering it is a general api that is must have for other nested configurations on top? – R2D2 Dec 04 '22 at 12:41
  • I am not aware of any :/ – chresse Dec 05 '22 at 12:01
  • Yea actually this works but i was also hoping if there's a way to do it without relying on existing cluster. – miador Dec 07 '22 at 11:37