error: the server doesn‘t have a resource type “nginx-deployment“error: resource(s) were provided, b

问题:删除svc报错

[root@master1 k8s-nginx]# kubectl delete service -n nginx-deployment
error: resource(s) were provided, but no name was specified
[root@master1 k8s-nginx]# kubectl delete nginx-deployment  -n  default
error: the server doesn't have a resource type "nginx-deployment"
[root@master1 k8s-nginx]# kubectl get svc -owide  
NAME               TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)        AGE    SELECTOR
kubernetes         ClusterIP   10.96.0.1                443/TCP        140d   
nginx-deployment   NodePort    10.10.52.161           80:30003/TCP   8d     app=nginx-sv
[root@master1 k8s-nginx]# kubectl describe svc nginx-deployment
Name:                     nginx-deployment
Namespace:                default
Labels:                   app=nginx-sv
Annotations:              
Selector:                 app=nginx-sv
Type:                     NodePort
IP Family Policy:         SingleStack
IP Families:              IPv4
IP:                       10.10.52.161
IPs:                      10.10.52.161
Port:                     nginx-sv  80/TCP
TargetPort:               80/TCP
NodePort:                 nginx-sv  30003/TCP
Endpoints:                
Session Affinity:         None
External Traffic Policy:  Cluster
Events:                   

正确删除方法:

[root@master1 k8s-nginx]# kubectl delete svc nginx-deployment
service "nginx-deployment" deleted

你可能感兴趣的:(linux,docker,k8s)