Build user information for martin in the default kubeconfig - challenge1

Hello, I am trying to build user information with the below command, if it’s not right could you please share the correct command? screenshot attached.
$ kubectl config set-credentials martin --client-key=martin.key --client-certificate=martin.crt --embed-certs=true
Thank you.

Hi @mhkabir.ewu

You have set the credentials correctly, but you also need to set the context and then use it.

Full solution to this can be found here: https://github.com/kodekloudhub/kubernetes-challenges/tree/master/challenge-1

Thank you for your reply. There is one confusion here: what are the differences between below two commands? Where 1the st command from k8s documents is not working but the 2nd one is working fine:

  1. kubectl config set-credentials martin --client-key=martin.key --client-certificate=martin.crt --embed-certs=true
  2. kubectl config set-credentials martin --client-certificate ./martin.crt --client-key ./martin.key

can you please explain? thanks in advance.

--embed-certs does what it says on the tin. It embers the certificate content inside the kubeconfig file, as base64 data. That is it reads in the data from the files at --client-certificate and --client-key.

Without --embed-certs it just puts the paths to the files you gave with --client-certificate and --client-key

Both are valid, but it would seem that the lab validation checks only for the second form. I will get it checked.

2 Likes

thank you so much for clarifying it.