PKI certificates and requirements

    Kubernetes requires PKI for the following operations:

    • Client certificates for the kubelet to authenticate to the API server
    • Server certificate for the API server endpoint
    • Client certificates for administrators of the cluster to authenticate to the API server
    • Client certificates for the API server to talk to the kubelets
    • Client certificate/kubeconfig for the controller manager to talk to the API server
    • Client certificate/kubeconfig for the scheduler to talk to the API server.
    • Client and server certificates for the front-proxy

    Note: certificates are required only if you run kube-proxy to support .

    etcd also implements mutual TLS to authenticate clients and peers.

    If you install Kubernetes with kubeadm, most certificates are stored in /etc/kubernetes/pki. All paths in this documentation are relative to that directory, with the exception of user account certificates which kubeadm places in /etc/kubernetes.

    If you don’t want kubeadm to generate the required certificates, you can create them using a single root CA or by providing all certificates. See Certificates for details on creating your own certificate authority. See for more on managing certificates.

    You can create a single root CA, controlled by an administrator. This root CA can then create multiple intermediate CAs, and delegate all further creation to Kubernetes itself.

    Required CAs:

    If you don’t wish to copy the CA private keys to your cluster, you can generate all certificates yourself.

    Required certificates:

    Default CNParent CAO (in Subject)kindhosts (SAN)
    kube-etcdetcd-caserver, clientlocalhost, 127.0.0.1
    kube-etcd-peeretcd-caserver, client<hostname>, <Host_IP>, localhost,
    kube-etcd-healthcheck-clientetcd-caclient
    kube-apiserver-etcd-clientetcd-casystem:mastersclient
    kube-apiserverkubernetes-caserver<hostname>, <Host_IP>, <advertise_IP>, [1]
    kube-apiserver-kubelet-clientkubernetes-casystem:mastersclient
    front-proxy-clientkubernetes-front-proxy-caclient

    [1]: any other IP or DNS name you contact your cluster on (as used by kubeadm the load balancer stable IP and/or DNS name, kubernetes, kubernetes.default, kubernetes.default.svc, kubernetes.default.svc.cluster, kubernetes.default.svc.cluster.local)

    where maps to one or more of the types:

    Note: Hosts/SAN listed above are the recommended ones for getting a working cluster; if required by a specific setup, it is possible to add additional SANs on all the server certificates.

    Note:

    For kubeadm users only:

    • The scenario where you are copying to your cluster CA certificates without private keys is referred as external CA in the kubeadm documentation.
    • If you are comparing the above list with a kubeadm generated PKI, please be aware that kube-etcd, kube-etcd-peer and kube-etcd-healthcheck-client certificates are not generated in case of external etcd.
    Default CNrecommended key pathrecommended cert pathcommandkey argumentcert argument
    etcd-caetcd/ca.keyetcd/ca.crtkube-apiserver—etcd-cafile
    kube-apiserver-etcd-clientapiserver-etcd-client.keyapiserver-etcd-client.crtkube-apiserver—etcd-keyfile—etcd-certfile
    kubernetes-caca.keyca.crtkube-apiserver—client-ca-file
    kubernetes-caca.keyca.crtkube-controller-manager—cluster-signing-key-file—client-ca-file, —root-ca-file, —cluster-signing-cert-file
    kube-apiserverapiserver.keyapiserver.crtkube-apiserver—tls-private-key-file—tls-cert-file
    kube-apiserver-kubelet-clientapiserver-kubelet-client.keyapiserver-kubelet-client.crtkube-apiserver—kubelet-client-key—kubelet-client-certificate
    front-proxy-cafront-proxy-ca.keyfront-proxy-ca.crtkube-apiserver—requestheader-client-ca-file
    front-proxy-cafront-proxy-ca.keyfront-proxy-ca.crtkube-controller-manager—requestheader-client-ca-file
    front-proxy-clientfront-proxy-client.keyfront-proxy-client.crtkube-apiserver—proxy-client-key-file—proxy-client-cert-file
    etcd-caetcd/ca.keyetcd/ca.crtetcd—trusted-ca-file, —peer-trusted-ca-file
    kube-etcdetcd/server.keyetcd/server.crtetcd—key-file—cert-file
    kube-etcd-peeretcd/peer.keyetcd/peer.crtetcd—peer-key-file—peer-cert-file
    etcd-caetcd/ca.crtetcdctl—cacert
    kube-etcd-healthcheck-clientetcd/healthcheck-client.keyetcd/healthcheck-client.crtetcdctl—key—cert

    Same considerations apply for the service account key pair:

    The following example illustrates the file paths from the previous tables you need to provide if you are generating all of your own keys and certificates:

    You must manually configure these administrator account and service accounts:

    filenamecredential nameDefault CNO (in Subject)
    admin.confdefault-adminkubernetes-adminsystem:masters
    kubelet.confdefault-authsystem:node:<nodeName> (see note)system:nodes
    controller-manager.confdefault-controller-managersystem:kube-controller-manager
    scheduler.confdefault-schedulersystem:kube-scheduler

    Note: The value of <nodeName> for kubelet.conf must match precisely the value of the node name provided by the kubelet as it registers with the apiserver. For further details, read the .

    1. Run kubectl as follows for each config:

    These files are used as follows: