–dry-run 选项只能为 “none”、“server”、"client"三者中的一个,默认是none;当不加该参数,或者为none的时候,该操作后资源会生效 ,请求会被发送到kube-apiserver并做实际更改;当该参数为client的时候,只打印该对象并不会发送请求且并不会实际创建该对象;当该参数为server的时候,会发送请求到服务端,但是并不会实际创建该对象。(If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.)
[root@yyzc-zjjcs01 ~]# /opt/kubernetes/bin/kubectl --kubeconfig /opt/kubernetes/conf/default-admin.kubeconfig create --dry-run='none' clusterrole foo --verb=get,list,watch --resource=pods
clusterrole.rbac.authorization.k8s.io/foo creat