定位 发表于 2025-7-13 21:01:18

通过curl命令访问集群

解码base64编码的证书和密钥 /root/.kube/config
上述文件中的证书和密钥是以base64编码的形式存储的。你可以使用base64命令将其解码为可读的PEM格式

1、解码CA证书
echo "<base64-encoded-ca-cert>" | base64 --decode > /root/ca.crt

2、解码客户端证书
echo "<base64-encoded-client-cert>" | base64 --decode > /root/client.crt

3、解码客户端密钥
echo "<base64-encode-client-key>" | base64 --decode > /root/client.key

总结:
通过上述步骤,你可以从~/.kube/config 文件中提取并解码kubernetes 集群的证书和密钥文件。请注意:这些文件包含敏感信息,务必妥善保管。

通过curl命令访问集群有两种方式:
1、需要ssl证书验证
curl --cacert /root/ca.crt --cert /root/client.crt --key /root/client.key https://10.108.11.1/api/v1/nodes

2、忽略ssl证书验证
curl -k --cacert /root/ca.crt --cert /root/client.crt --key /root/client.key https://10.108.11.1/api/v1/nodes
页: [1]
查看完整版本: 通过curl命令访问集群