I have a problem with minikube
when I want to create deployment manifest files, I receive an error
when I write this code:
minikube kubectl create -f .
I got this Error:
Error: unknown shorthand flag: 'f' in -f See 'minikube kubectl --help' for usage.
but not only this, I try to write another command but again same error happening
minikube kubectl delete daemonsets,replicasets,services,deployments,pods,rc,pvc --all
Error: unknown flag: --all
See 'minikube kubectl --help' for usage.
please help me. thanks
AFAIK, --all is not a valid flag. Valid flag is --all-namespaces or just -A.
However, "kubectl delete" does not take -A as it needs the resource name for deletion.
To accomplish what you are trying to do you will have to write a loop to delete the objects 1 by one using
kubectl get daemonsets,replicasets,services,deployments,pods,rc,pvc -A --no-headers | while read line; do
namespace=$(echo $line | awk '{print $1}')
resource=$(echo $line | awk '{print $2}')
kubectl delete ${resource} -n ${namespace}
done
Execution - BE extremely careful with this as it will delete all queried resources in all namespaces including those in kube-system namespace:
controlplane $ kubectl get daemonsets,replicasets,services,deployments,pods,rc,pvc -A --no-headers | while read line; do
> namespace=$(echo $line | awk '{print $1}')
> resource=$(echo $line | awk '{print $2}')
> kubectl delete ${resource} -n ${namespace}
> done
daemonset.extensions "kube-keepalived-vip" deleted
daemonset.extensions "kube-proxy" deleted
daemonset.extensions "weave-net" deleted
replicaset.extensions "coredns-fb8b8dccf" deleted
replicaset.extensions "katacoda-cloud-provider-d5cb9d656" deleted
service "kubernetes" deleted
service "kube-dns" deleted
deployment.extensions "coredns" deleted
deployment.extensions "katacoda-cloud-provider" deleted