API usage in k8s - ganeshahv/Contrail_SRE GitHub Wiki
cURL usage
- Copy the client-certificate-data, client-key-data and the certificate-authority-data from the kube config file.
 
less  ̃/.kube/config
export client=$(grep client-cert  ̃/.kube/config |cut -d" " -f 6)
export key=$(grep client-key-data  ̃/.kube/config |cut -d " " -f 6)
export auth=$(grep certificate-authority-data  ̃/.kube/config |cut -d " " -f 6)
- Pull the API server URL from the config file.
 
kubectl config view |grep server
- User the curl command
 
curl --cert ./client.pem --key ./client-key.pem --cacert ./ca.pem https://k8smaster:6443/api/v1/pods
To verify resources
- Go to the home dir
 
cd /home/ubuntu/.kube/cache/discovery/k8smaster_6443
python -m json.tool v1/serverresources.json
python -m json.tool apps/v1/serverresources.json