Basic question about authenticating to minikube api-server using curl with client cert and key.
When I curl /ping endpoint on api-server, I get back a 403 (expected, fails authentication)
curl -k https://127.0.0.1:32776/ping
{
"kind": "Status",
"apiVersion": "v1",
"metadata": {
},
"status": "Failure",
"message": "forbidden: User \"system:anonymous\" cannot get path \"/ping\"",
"reason": "Forbidden",
"details": {
},
"code": 403
}
And to fix the same, I'm trying the below curl command I'm using
curl -v
--cert /Users/blah/.minikube/profiles/minikube/client.crt \
--cacert /Users/blah/.minikube/ca.cert \
--key /Users/blah/.minikube/profiles/minikube/client.key \
https://127.0.0.1:32776/ping
and I get back
* Trying 127.0.0.1:32776...
* Connected to 127.0.0.1 (127.0.0.1) port 32776 (#0)
* ALPN, offering http/1.1
* WARNING: SSL: CURLOPT_SSLKEY is ignored by Secure Transport. The private key must be in the Keychain.
* WARNING: SSL: Certificate type not set, assuming PKCS#12 format.
* SSL: Can't find the certificate "/Users/blah/.minikube/profiles/minikube/client.crt" and its private key in the Keychain.
* Closing connection 0
curl: (58) SSL: Can't find the certificate "/Users/blah/.minikube/profiles/minikube/client.crt" and its private key in the Keychain.
I'm using the above certs as described in
kubectl config view
apiVersion: v1
clusters:
- cluster:
certificate-authority: /Users/blah/.minikube/ca.crt
server: https://127.0.0.1:32776
name: minikube
contexts:
- context:
cluster: minikube
user: minikube
name: minikube
current-context: minikube
kind: Config
preferences: {}
users:
- name: minikube
user:
client-certificate: /Users/blah/.minikube/profiles/minikube/client.crt
client-key: /Users/blah/.minikube/profiles/minikube/client.key
I think this is more of curl usage details that I'm missing, minikube seems to be fine. Also, I'm curious how others authenticating curl requests to minikube?