kubernetes

How to delete an API resource in Kubernetes?


I ran:

kubectl api-resources | grep "External"
externalmetrics                                     metrics.aws                    true         ExternalMetric

I want to delete this metrics.aws API resource, but I am not even sure how it was deployed. How can I delete this safely?


Solution

  • kubectl get crds | grep externalmetrics 
    
    kubectl get externalmetrics
    kubectl delete externalmetrics --all 
    
    kubectl delete crd externalmetrics
    
    kubectl api-resources
    

    Update:

    If you see error: the server doesn't have a resource type "v1beta1" error then run the following command to remove it:

    kubectl delete apiservice v1beta1.metrics.k8s.io