Hi Team, I'm practicing Certificate API topic and created the CSR as mentioned . . .

Akhil Addagulla:
Hi Team,

I’m practicing Certificate API topic and created the CSR as mentioned below. After creating the CSR when run “kubectl get csr”. I can’t view it. Am I missing something

Note: I’ll add the group details.

root@controlplane ~ ➜  cat s.yaml 
---
apiVersion: <http://certificates.k8s.io/v1|certificates.k8s.io/v1>
kind: CertificateSigningRequest
metadata:
  name: akshay
spec:
  request: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURSBSRVFVRVNULS0tLS0KTUlJQ1ZqQ0NBVDRDQVFBd0VURVBN
  QTBHQTFVRUF3d0dZV3R6YUdGNU1JSUJJakFOQmdrcWhraUc5dzBCQVFFRgpBQU9DQVE4QU1JSUJD
  Z0tDQVFFQXhyejllUDBWbmI0OFpqVk9LeXZKKzZGTTR3Q2M1UEJSNlpkRUhwcmQ2UXUrCmJRQlND
  cnd1YXNZVVg1U2VMYzgrSDNCNnIvTEN3c29lc1dLTXM4L1R3SDA0U3hyUjYvbFk5UWo2eEVFbTFM
  c3YKRWt3K2NVM0RHMkt1aFBEaWpkWTZsaGpzSFlldVZ2dDBmNlR6dmRjejFFNWdQSWVFbUQ5Zm44
  c3NxNDlEOEY3OQpKTmJzRDVvWkxuU2hxNFNWS2lRbFdCNlZZRTBCWXk5USt1SUIxT09oZXZIUjZy
  WXJWejJWVkJDaFc2MmNPdjBRCkdSUjlQN2JZSHBBbGdsTkRqUG1BZHNwZlNqWHoxSUVrNU1xUjVI
  RGRUdGFJK1JQSFBSRkUvMHlGdTdCVkFzRGcKaUY2enBGR2FJNFR0VVkxSk1JcVJZQUdlQjViTTV3
  cHYrU2dZL0JYQ3BRSURBUUFCb0FBd0RRWUpLb1pJaHZjTgpBUUVMQlFBRGdnRUJBSXcyVmFOd0dY
  aDAySTFWZG1FakZYNlFFV1JFc0hFMFNzMURWMUhibms0L1cwcUpMQTNWClVqeEFyY0ZGVEZidThJ
  N0VFTUFyTysyRVVIMGxQUStNRnB0NjZBcHlSWUJWUzkwTVZGK3dVc1crRVMvM3pPUjQKRExyY0hk
  bzRkbmxreU03cklqUU1EM0N2bFNQbTRweXA2aUhyWU5qbzRjblZwWXRrbTM1aWNRWEpTdkFzWTlF
  cQpyL2FtUHFRR2l2MndVQzVRbTlrQVZwU3o4L1l1aitzZUpMSEFLcG8zTTVvVkdGRnJvWnE1cndC
  cjZIQ3hkV0FYClRZL3BwSHBkZVVCcndOUU9tR0Zhdk5mL1ZhQ3IzMklJN2MvQnFsRUpEWEE3Q1FD
  eHA1MjRNcWVxdUh5TUwrcWkKMVRWSWdGbmJ6WDVHK1ZHRlh1NmNkQnh2Y0M3eHZoZXprMUk9Ci0t
  LS0tRU5EIENFUlRJRklDQVRFIFJFUVVFU1QtLS0tLQo=
  signerName: <http://kubernetes.io/kube-apiserver-client|kubernetes.io/kube-apiserver-client>
  expirationSeconds: 86400  # one day
  usages:
  - client auth
root@controlplane ~ ➜  kubectl get csr

NAME        AGE   SIGNERNAME                                    REQUESTOR                  REQUESTEDDURATION   CONDITION
csr-q5kwj   30m   <http://kubernetes.io/kube-apiserver-client-kubelet|kubernetes.io/kube-apiserver-client-kubelet>   system:node:controlplane   &lt;none&gt;              Approved,Issued

Radoslaw Czajkowski:
https://kubernetes.io/docs/reference/access-authn-authz/certificate-signing-requests/

Radoslaw Czajkowski:
Export the issued certificate from the CertificateSigningRequest.

Radoslaw Czajkowski:

kubectl get csr myuser -o jsonpath='{.status.certificate}'| base64 -d &gt; myuser.crt

Akhil Addagulla:

root@controlplane ~ ✖ kubectl get csr akshay -o jsonpath='{.status.certificate}'| base64 -d &gt; myuser.crt
Error from server (NotFound): <http://certificatesigningrequests.certificates.k8s.io|certificatesigningrequests.certificates.k8s.io> "akshay" not found

Akhil Addagulla:
@Radoslaw Czajkowski: As soon as I create the yaml file. What should I do??

Akhil Addagulla:
The problem is I can’t even view my csr

Akhil Addagulla:
When I use the get csr command it not even showing up

Radoslaw Czajkowski:
but you have a csr named csr-q5kwj?

Radoslaw Czajkowski:
k get csr csr-q5kwj -o yaml

Radoslaw Czajkowski:
what does it show?

Akhil Addagulla:

root@controlplane ~ ➜  k get csr csr-q5kwj -o yaml
Error from server (NotFound): <http://certificatesigningrequests.certificates.k8s.io|certificatesigningrequests.certificates.k8s.io> "csr-q5kwj" not found

Radoslaw Czajkowski:
ah okay you haven’t created a CSR for your user yet

Radoslaw Czajkowski:

Radoslaw Czajkowski:
go through these steps from the doc I attached

Akhil Addagulla:
I created

Akhil Addagulla:

root@controlplane ~ ✖ ls
akshay.csr  akshay.key  myuser.crt  s.yaml

Radoslaw Czajkowski:
okay did you apply that yaml file?

Radoslaw Czajkowski:
k apply -f s.yaml

Akhil Addagulla:
It worked now but when I applied last time it showed me error.