# Check to see if I can create pods in any namespace kubectl auth can-i create pods --all-namespaces # Check to see if I can list deployments in my current namespace kubectl auth can-i list deployments.extensions # Check to see if I can do everything in my current namespace ("*"...
kubectl [command] [TYPE] [NAME] [flags]command:对资源执行相应操作的子命令,如get、create、delete、run、describe等 TYPE:要操作的资源对象的类型,如pods、services等,类型名称区分大小写,但支持使用简写格式 NAME:对象名称,区分字符大小写;省略时,则表示指定TYPE的所有资源对象 flags:命令行选项,-o 用于指定输...
$ kubectl delete pods,services -l name=myLabel --include-uninitialized # 删除带有标签 name=myLabel 的 pod 和 service,包括未初始化的对象 $ kubectl -n my-ns delete po,svc --all # 删除命名空间 my-ns 下所有的 pod 和 service,包括未初始化的对象 $ kubectl --all-namespaces get po -o wdi...
kubectl get pod --all-namespaces 获取所有命名空间下的运行的所有Pod的标签: kubectl get pod --show-labels 获取该节点的所有命名空间: kubectl get namespace 说明: 类似可以使用“kubectl get svc”,“kubectl get nodes”,“kubectl get deploy”等获取其他资源的信息。
Use "kubectl <command> --help" for more information about a given command. Use "kubectl options" for a list of global command-line options (applies to all commands). kubectl 子命令 kubectl 的子命令非常丰富,涵盖了对 Kubernetes 集群的主要操作,包括资源对象的创建、删除、查看、修改、配置、运行等...
kubectl [command] [TYPE] [NAME] [flags] -o=<output_format> command: 表示要执行的操作,如:create, get, describe, delete。 TYPE:表示操作的资源类型,大小写不敏感,可以指定单数、复数或缩写。 NAME:指定resource的name,大小写敏感,不指定的话,针对所有。
$ kubectl [command] [TYPE] [NAME] [flags] command:子命令 TYPE:资源类型 NAME:资源名称 flags:命令参数 命令帮助 kubectl命令的帮助很详细, kubectl -h 会列出所有的子命令,在任何子命令后跟 -h,都会输出详细的帮助以及用例,遇到问题可以随时查看帮助。
Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists. recursive R false Process the directory used in -f, --file...
Use "kubectl options" for a list of global command-line options (applies to all commands). 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. ...
POST /apis/apps/v1/namespaces/{namespace}/replicasets 您可以在https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#create-replicaset-v1-apps中找到所有Kubernetes操作的API端点。要向端点发出实际请求,需要将API服务器的URL添加到API引用中列 ...