I am working on a Minikube cluster in Windows environment for learning purposes. I am trying out some authentication and authorization methods. Following are the steps involved.
apiVersion: certificates.k8s.io/v1
kind: CertificateSigningRequest
metadata:
name: student-csr
spec:
groups:
- system:authenticated
request: <encoded value>
signerName: kubernetes.io/kube-apiserver-client
usages:
- digital signature
- key encipherment
- client auth
I have provided base64 encoded value of certificate content as the value for request field.
kubectl create -f signing-request.yaml
kubectl certificate approve student-csr
kubectl get csr student-csr -o jsonpath='{.status.certificate}' | base64 --decode > student.crt
Now, when I try to configure kubectl client configuration with student user's credentials by providing key and certificate,
kubectl config set-credentials student --client-certificate=student.crt --client-key=student.key
it throws the following error.
error: Rel: can't make F:\CKAD\BasicLF\rbac\student.crt relative to C:\Users\Nilucshan\.kube
I am executing my kubectl command from my working directory (F:\CKAD\BasicLF\rbac
). kubectl.exe is placed in C drive.
But it works successfully if I place my key and certificate files inside C:\Users\Nilucshan\.kube
directory.
What is the problem here? Why isn't it working when my key and certificate files are placed in my working directory?
I had the same problem doing it from another partition. You can create the directory inside your user folder C:\Users\Nilucshan instead of .kube