Adding another user =================== First, create a new namespace: ```console $ kubectl create ns foo-ns namespace/foo-ns created ``` Next, create a new user: ```console $ sudo useradd -s /bin/bash -m foo $ sudo passwd foo New password: Retype new password: passwd: password updated successfully $ sudo mkdir -p /home/foo/.kube /home/foo/.minikube /home/foo/rbac ``` ## Authenticating the new user Generate keys and certificates for the new user: ```console $ openssl genrsa -out foo.key 2048 $ openssl req -new -key foo.key -out foo.csr -subj "/C=GB/CN=foo/L=Cambridge/O=YinChi_Test" $ cat > signing-request.yaml < foo.crt $ kubectl config set-credentials foo --client-certificate=foo.crt --client-key=foo.key User "foo" set. ``` View the new signing request: ```console $ kubectl describe csr foo-csr Name: foo-csr Labels: Annotations: CreationTimestamp: Sat, 03 Aug 2024 19:19:26 +0100 Requesting User: minikube-user Signer: kubernetes.io/kube-apiserver-client Status: Approved,Issued Subject: Common Name: foo Serial Number: Organization: YinChi_Test Country: GB Locality: Cambridge Events: ``` ## Seting permissions Authorize pod read access to the new user `foo` in the `foo-ns` namespace, using the context `foo-context`: ```console $ kubectl config set-context foo-context --cluster=minikube --namespace=foo-ns --user=foo Context "foo-context" created. $ cat > role.yaml < rolebinding.yaml <