<p>I'm trying to secure my k8s cluster, and I'm looking at client-authentication authorization support for k8s. My requirement is that I want to be able to uniquely identify myself (e.g. client) to the k8s apiserver, but everything I read so far about client authentication is not the solution.  </p>

<p>My understanding is that the server will just ensure that the client certificate provided is in fact signed by the certificate authority.  What if a hacker gets another certificate signed by the same certificate authority (which isn't hard to do in my org) and uses that to talk to my server?  It appears that popular orchestrations like Swarm and k8s support this option and touted it as most secure so there must be a reason for doing this.  Can someone shed some light?</p>

<p>It is not only verified that the certificate is authorized by the CA. The client certificate also contains the <a href="https://kubernetes.io/docs/admin/authentication/#x509-client-certs" rel="nofollow noreferrer">Common Name (CN)</a> which can be used with a simple <a href="https://kubernetes.io/docs/admin/authorization/" rel="nofollow noreferrer">ABAC Authorization</a> to limit the access to specific users or groups.</p>

<p>Also it shouldn't be easy to get a signed certificate. IMO the access to the root CA should be very limited and it should be comprehensible who is allowed to sign certs and when it happened. Ideally the root CA should life on a offline host.</p>

<p>Beside that it sounds like the CA is also used for other purposes. If it is so, you could consider to create a separate root cert for the client authentication. You can use a different CA for the server certificate by setting different CA files for <code>--client-ca-file</code> and <code>--tls-ca-file</code> on the <a href="https://kubernetes.io/docs/admin/kube-apiserver/" rel="nofollow noreferrer">apiserver</a>. That way you can restrict who is able to create client certificates and still verify the server identity with the CA of your organization (which might already be distributed on all org computers).</p>

<h3>Other Authentication Methods</h3>

<p>As mentioned Kubernetes also has some other authenication methods. The <a href="https://kubernetes.io/docs/admin/authentication/#static-token-file" rel="nofollow noreferrer">static token file</a> and the <a href="https://kubernetes.io/docs/admin/authentication/#static-password-file" rel="nofollow noreferrer">static password file</a> have the disadvantage that the secrets have to be stored plain text on the disk. Also the apiserver has to be restarted on every change.</p>

<p><a href="https://kubernetes.io/docs/admin/authentication/#service-account-tokens" rel="nofollow noreferrer">Service account tokens</a> are designated to be used by applications which run in the cluster.</p>

<p><a href="https://kubernetes.io/docs/admin/authentication/#openid-connect-tokens" rel="nofollow noreferrer">OpenID</a> might be a secure alternative to client certificates, but AFAIK it is way harder to set up. Especially when there is no OpenID server, yet.</p>

<p>I don't know much about the other authenication methods, but they look like they are intended for integrating with existing single-sign-on services.</p>
