如何在kubernetes中安装已删除的默认API服务?

nnsrf1az  于 2022-12-11  发布在  Kubernetes
关注(0)|答案(1)|浏览(128)

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.

a11xaf1n

a11xaf1n1#

您可以通过以下方式重新创建它:

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

相关问题