Reputation: 23
I used Kubernetes document to create a request for user certificate via API-server.
cat <<EOF | kubectl apply -f -
apiVersion: certificates.k8s.io/v1beta1
kind: CertificateSigningRequest
metadata:
name: myuser
spec:
request: $(cat server.csr | base64 | tr -d '\n')
usages:
- digital signature
- key encipherment
- server auth
EOF
I generated the certificate, created the kubeconfig file and created the necessary role/rolebindings successfully. However, when I try to access the cluster, I get the below error. I am quite sure that the issue is with the above yaml definition; but could not figure out.
users error: You must be logged in to the server (Unauthorized)
Any idea please?
Upvotes: 2
Views: 57
Reputation: 549
Seems, the issue is with the "spec" part. It is user authentication not server authentication. Hence, "server auth" should be client auth.
spec:
request: $(cat server.csr | base64 | tr -d '\n')
usages:
- digital signature
- key encipherment
- client auth
Upvotes: 2