Kubernetes Authentication Client Certificate
Analyzes Kubernetes authentication methods based on client certificates.
1. Kubernetes Authentication Client Certificate
![[Figure 1] Kubernetes Authentication Client Certificate](/blog-software/docs/theory-analysis/kubernetes-authentication-client-certificate/images/kubernetes-authentication-client-certificate.png)
[Figure 1] Kubernetes Authentication Client Certificate
Kubernetes provides authentication methods based on client certificates. [Figure 1] shows Kubernetes authentication methods based on client certificates. Client certificates and keys are created by signing with a Client CA certificate. The Kubernetes API Server obtains the Client CA certificate through the --client-ca-file option. When a client accesses the Kubernetes API Server with the client’s certificate and key, the Kubernetes API Server verifies whether the client’s certificate is valid through the Client CA certificate and client key.
A client certificate contains one CN (Common Name) and multiple O (Organization) fields. In Kubernetes, the value of the CN field is recognized as the user’s name, and the value of the O field is recognized as the group’s name. Therefore, to grant roles to clients authenticated through client certificates and keys, roles should be granted to users or groups in the client certificate. The client certificate in [Figure 1] has ssup2 set as the user’s name, and system:masters and kube set as group names.
| |
| |
[Text 1] shows a Role Binding to grant a role to the ssup2 user, and [Text 2] shows a Role Binding to grant a role to the kube group. Groups starting with system: are reserved group names in Kubernetes. Therefore, the system:masters group also refers to a reserved group in Kubernetes. In Kubernetes, the system:masters group is a group with super privileges.
| |
Client certificates can also be used in kubectl through kubeconfig settings. [Text 3] shows a kubeconfig using a client certificate. Set the client certificate content in the client-certificate-data field and set the client key in the client-key-data field.