Qustion
How can I access the API server API with the client certificate? Tried below but no success.
export K8S_PKI_HOME=/etc/kubernetes/pki
curl -k --key ${K8S_PKI_HOME}/ca.key --cert ${K8S_PKI_HOME}/ca.crt \
https://localhost:6443/api/v1/componentstatuses
{
"kind": "Status",
"apiVersion": "v1",
"metadata": {
},
"status": "Failure",
"message": "componentstatuses is forbidden: User \"kubernetes\" cannot list componentstatuses at the cluster scope",
"reason": "Forbidden",
"details": {
"kind": "componentstatuses"
},
"code": 403
}
According to X509 Client Certs (Authentication Strategy:
Client certificate authentication is enabled by passing the --client-ca-file=SOMEFILE option to API server.
In the /etc/kubernetes/manifests/kube-apiserver.yaml, --client-ca-file=/etc/kubernetes/pki/ca.crt is specified.
spec:
containers:
- command:
- kube-apiserver
- --client-ca-file=/etc/kubernetes/pki/ca.crt