kubernetes 如何执行此操作以批准处于“已拒绝”状态的CSR?

tag5nh1u  于 2023-01-20  发布在  Kubernetes
关注(0)|答案(1)|浏览(268)

查看节点状态:kubectl get csr

[root@kube1 ~]# kubectl get csr
NAME                                                   AGE    REQUESTOR                 CONDITION
node-csr--jJF_sRckTdhoqAOYB4fEaA06Juwv32d1RFwzcbbE0c   150m   system:bootstrap:gn5vla   Pending
node-csr-KMkTDLPqhj52YxZFS8vEOiqMt1NXVEcYvmvUJAhxhwg   150m   system:bootstrap:xay6t6   Pending
node-csr-bv18tH4pK-xq7Ekwv0IuzD4CcBuvKjjdonBjpKqHuPQ   150m   system:bootstrap:v1g4p2   Pending

执行拒绝:

kubectl get csr | grep Pending| awk '{print $1}' | xargs kubectl certificate deny

再次查看节点状态:kubectl get csr

[root@kube1 ~]# kubectl get csr
NAME                                                   AGE    REQUESTOR                 CONDITION
node-csr--jJF_sRckTdhoqAOYB4fEaA06Juwv32d1RFwzcbbE0c   150m   system:bootstrap:gn5vla   Denied
node-csr-KMkTDLPqhj52YxZFS8vEOiqMt1NXVEcYvmvUJAhxhwg   150m   system:bootstrap:xay6t6   Denied
node-csr-bv18tH4pK-xq7Ekwv0IuzD4CcBuvKjjdonBjpKqHuPQ   150m   system:bootstrap:v1g4p2   Denied

如何执行此操作以批准处于“已拒绝”状态的CSR?

oknwwptz

oknwwptz1#

简而言之,您不能。一旦拒绝CSR,您需要发布新的CSR并根据需要批准它。如果不想在此处看到已拒绝的CSR,您可以使用以下命令删除它们:

kubectl delete csr <csr-name>

此外,要删除所有被拒绝的请求,请用途:

kubectl get csr | grep Denied | awk '{print $1;}' | xargs kubectl delete csr

相关问题