通过curl命令访问K8s API

使用token

token="eyJhbGciOiJSUzI1NiIsI..."
curl --cacert /etc/kubernetes/pki/ca.crt -H "Authorization: Bearer $token"  https://192.168.31.61:6443/api/v1/namespaces/default/pods

使用证书

curl https://192.168.31.61:6443/api/v1/nodes \
--cacert /etc/kubernetes/pki/ca.crt \
--cert /etc/kubernetes/pki/apiserver-kubelet-client.crt \
--key /etc/kubernetes/pki/apiserver-kubelet-client.key   
上一篇:2021-04-02


下一篇:自助生成https的crt和key证书