By mistake I created a service account to give admin permission for dashboard. But now I am unable to delete it.
The reason I want to get rid of that service account is if I follow the steps here https://github.com/kubernetes/dashboard. When I jump to the URL it doesn't ask for config/token anymore.
$ kubectl get serviceaccount --all-namespaces | grep dashboard
NAMESPACE NAME SECRETS AGE
kube-system kubernetes-dashboard 1 44m
$ kubectl delete serviceaccount kubernetes-dashboard
Error from server (NotFound): serviceaccounts "kubernetes-dashboard" not found
You can delete a StatefulSet in the same way you delete other resources in Kubernetes: use the kubectl delete command, and specify the StatefulSet either by file or by name. You may need to delete the associated headless service separately after the StatefulSet itself is deleted.
To delete the pod you have created, just run kubectl delete pod nginx . Be sure to confirm the name of the pod you want to delete before pressing Enter. If you have completed the task of deleting the pod successfully, pod nginx deleted will appear in the terminal.
Kubernetes service accounts are Kubernetes resources, created and managed using the Kubernetes API, meant to be used by in-cluster Kubernetes-created entities, such as Pods, to authenticate to the Kubernetes API server or external services.
You have to specify the namespace when deleting it:
kubectl delete serviceaccount -n kube-system kubernetes-dashboard
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With