kubectl create 属于Imperative command(祈使式命令),它明确告诉kubectl要创建某个资源或对象;

kubectl apply 是Declarative command(声明式命令),apply并不告诉kubectl具体做什么,而是由kubectl根据后面-f中的yaml文件与k8s中对应的object对比,自动探测要进行哪些操作,比如如果object不存在,则create;如果已经存在,则对比差异,update and replace

Delete
根据resource名或label删除resource。
kubectl delete -f rc-nginx.yaml
kubectl delete po rc-nginx-btv4j
kubectl delete po -lapp=nginx-2

[root@master opt]# kubectl delete  -f kubernetes-dashboard.yaml
secret "kubernetes-dashboard-certs" deleted
serviceaccount "kubernetes-dashboard" deleted
role.rbac.authorization.k8s.io "kubernetes-dashboard-minimal" deleted
rolebinding.rbac.authorization.k8s.io "kubernetes-dashboard-minimal" deleted
deployment.apps "kubernetes-dashboard" deleted
service "kubernetes-dashboard" deleted

docker images 查看镜像 直接删除dashboard.tar 重新 加载

[root@master opt]# docker rmi -f wl/kubernetes-dashboard-amd6:v1.10.1 
[root@node01 opt]# docker load -i dashboard.tar
Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐