Difference between revisions of "Curl k8s"
Jump to navigation
Jump to search
(Created page with "curl --cert userbob.pem --key userBob-key.pem \ --cacert /path/to/ca.pem \ https://k8sServer:6443/api/v1/pods") |
|||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | ``` | ||
+ | kubectl config view --minify --raw --output 'jsonpath={..cluster.certificate-authority-data}' | base64 -d > ca.pem | ||
+ | kubectl config view --minify --raw --output 'jsonpath={..user.client-certificate-data}' | base64 -d > crt.pem | ||
+ | kubectl config view --minify --raw --output 'jsonpath={..user.client-key-data}' | base64 -d > key.pem | ||
+ | |||
+ | curl --cert crt.pem --key key.pem --cacert ca.pem https://$K8S_IP:6443/api/v1/pods | ||
+ | ``` | ||
+ | |||
+ | ``` | ||
curl --cert userbob.pem --key userBob-key.pem \ | curl --cert userbob.pem --key userBob-key.pem \ | ||
--cacert /path/to/ca.pem \ | --cacert /path/to/ca.pem \ | ||
https://k8sServer:6443/api/v1/pods | https://k8sServer:6443/api/v1/pods | ||
+ | ``` | ||
+ | |||
+ | ``` | ||
+ | https://10.128.0.3:6443/api/v1/namespaces/default/pods | ||
+ | ``` |
Latest revision as of 18:11, 3 January 2025
kubectl config view --minify --raw --output 'jsonpath={..cluster.certificate-authority-data}' | base64 -d > ca.pem kubectl config view --minify --raw --output 'jsonpath={..user.client-certificate-data}' | base64 -d > crt.pem kubectl config view --minify --raw --output 'jsonpath={..user.client-key-data}' | base64 -d > key.pem curl --cert crt.pem --key key.pem --cacert ca.pem https://$K8S_IP:6443/api/v1/pods
curl --cert userbob.pem --key userBob-key.pem \ --cacert /path/to/ca.pem \ https://k8sServer:6443/api/v1/pods
https://10.128.0.3:6443/api/v1/namespaces/default/pods