Log into the Kubernetes control plane node and create a temporary directory that will hold the generated keys. Navigate into the directory:
Create a private key using the
openssl
executable. Provide an expressive file name, such as<username>.key
:Create a certificate sign request (CSR) in a file with the extension
.csr
. You need to provide the private key from the previous step. The-subj
option provides the username (CN) and the group (O). The following command uses the usernamejohndoe
and the group nameduser-group
. To avoid assigning the user to a group, leave off the /O component of the assignment:Lastly, sign the CSR with the Kubernetes cluster certificate authority (CA). The CA can usually be found in the directory
/etc/kubernetes/pki
and needs to contain the filesca.crt
andca.key
. We are going to use minikube here, which stores those files in the directory pass:[<code>~/.minikube</code>. The following command signs the CSR and makes it valid for 364 days:Create the user in Kubernetes by setting a user entry in kubeconfig for
johndoe
. Point to the CRT and key file. Set a context entry in kubeconfig forjohndoe
:To switch to the user, use the context named
johndoe-context
. You can check the current context using the commandconfig current-context
:
Pages
Showing posts with label Container. Show all posts
Showing posts with label Container. Show all posts
Wednesday, May 24, 2023
Kubernetes RBAC Authentication strategies
K8s requires that calls to the API server with a user must be authenticated. For successful authentication, K8s offers the following authentication methods :
1. X.509 client certificate = Uses an OpenSSL client certificate to authenticate
2. Basic authentication = Uses username and password to authenticate
3. Bearer tokens = Uses OpenID (a flavor of OAuth2) or webhooks as a way to authenticate
Steps for deploying X.509 client certificate based authentication:
Subscribe to:
Posts (Atom)