Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delete a configmap itself from Kubernetes

I am trying to delete a configmap from a k8s namespace .. i created the configmap using the command below

kubectl -n namespacename create -f configmap.yaml

checking the k8s cheat sheet https://kubernetes.io/docs/reference/kubectl/cheatsheet/ i didn't find anything related .. kindly advise how to do that ?

like image 402
Hany Habib Avatar asked Dec 12 '19 08:12

Hany Habib


People also ask

Can we edit ConfigMap in Kubernetes?

Method to edit ConfigMaps in Kubernetes using kubectlYou can alter the file as per your work needs.

Where are ConfigMap stored in Kubernetes?

Where Are Kubernetes ConfigMaps Stored? Kubernetes stores API objects like ConfigMaps and Secrets within the etcd cluster.

How do you force delete a service in Kubernetes?

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.

How do I permanently delete pods in Kubernetes?

First, confirm the name of the node you want to remove using kubectl get nodes , and make sure that all of the pods on the node can be safely terminated without any special procedures. Next, use the kubectl drain command to evict all user pods from the node.


1 Answers

To delete configmap using configmap name:

# kubectl delete configmap  <configmap-name>  -n  <namespace-name> 
$ kubectl delete configmap    my-cofigmap     -n   namespacename 

To delete configmap using configmap yaml file:

# kubectl delete -f <file-directory> -n <namespace-name>
$ kubectl delete -f  configmap.yaml  -n  namespacename
like image 101
Kamol Hasan Avatar answered Sep 19 '22 15:09

Kamol Hasan