```sh
APISERVER=$(kubectl config view --minify -o jsonpath='{.clusters[0].cluster.server}')
TOKEN=$(kubectl get secret $(kubectl get serviceaccount default -n dbackupd -o jsonpath='{.secrets[0].name}') -n dbackupd -o jsonpath='{.data.token}' | base64 --decode )
kubectl get secret $(kubectl get serviceaccount default -n dbackupd -o jsonpath='{.secrets[0].name}') -n dbackupd -o jsonpath='{.data.ca\.crt}' | base64 --decode > /tmp/ca.crt

curl $APISERVER/api --header "Authorization: Bearer $TOKEN" --insecure

curl $APISERVER/api/v1/namespaces/default/pods --header "Authorization: Bearer $TOKEN" --insecure

```sh
APISERVER=$(kubectl config view --minify -o jsonpath='{.clusters[0].cluster.server}')
TOKEN=$(kubectl get secret $(kubectl get serviceaccount default -n dbackupd -o jsonpath='{.secrets[0].name}') -n dbackupd -o jsonpath='{.data.token}' | base64 --decode )
kubectl get secret $(kubectl get serviceaccount default  -n dbackupd -o jsonpath='{.secrets[0].name}')  -n dbackupd -o jsonpath='{.data.ca\.crt}' | base64 --decode > /tmp/ca.crt

curl $APISERVER/api --header "Authorization: Bearer $TOKEN" --insecure

curl $APISERVER/api/v1/namespaces/default/pods --header "Authorization: Bearer $TOKEN" --insecure
```


打赏还是打残,这是个问题
立即登录, 发表评论.
没有帐号? 立即注册
0 条评论