You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/en/docs/reference/command-line-tools-reference/kubelet-tls-bootstrapping.md
+13-25Lines changed: 13 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,15 +14,15 @@ In a Kubernetes cluster, the components on the worker nodes - kubelet and kube-p
14
14
In order to ensure that communication is kept private, not interfered with, and ensure that each component of the cluster is talking to another trusted component, we strongly
15
15
recommend using client TLS certificates on nodes.
16
16
17
-
The normal process of bootstrapping these components, especially worker nodes that need certificates so they can communicate safely with kube-apiserver,
18
-
can be a challenging process as it is often outside of the scope of Kubernetes and requires significant additional work.
17
+
The normal process of bootstrapping these components, especially worker nodes that need certificates so they can communicate safely with kube-apiserver,
18
+
can be a challenging process as it is often outside of the scope of Kubernetes and requires significant additional work.
19
19
This in turn, can make it challenging to initialize or scale a cluster.
20
20
21
21
In order to simplify the process, beginning in version 1.4, Kubernetes introduced a certificate request and signing API to simplify the process. The proposal can be
22
22
found [here](https://github.com/kubernetes/kubernetes/pull/20439).
23
23
24
24
This document describes the process of node initialization, how to set up TLS client certificate bootstrapping for
25
-
kubelets, and how it works.
25
+
kubelets, and how it works.
26
26
27
27
28
28
@@ -90,15 +90,15 @@ In addition, you need your Kubernetes Certificate Authority (CA).
90
90
As without bootstrapping, you will need a Certificate Authority (CA) key and certificate. As without bootstrapping, these will be used
91
91
to sign the kubelet certificate. As before, it is your responsibility to distribute them to master nodes.
92
92
93
-
For the purposes of this document, we will assume these have been distributed to master nodes at `/var/lib/kubernetes/ca.pem` (certificate) and `/var/lib/kubernetes/ca-key.pem` (key).
93
+
For the purposes of this document, we will assume these have been distributed to master nodes at `/var/lib/kubernetes/ca.pem` (certificate) and `/var/lib/kubernetes/ca-key.pem` (key).
94
94
We will refer to these as "Kubernetes CA certificate and key".
95
95
96
96
All Kubernetes components that use these certificates - kubelet, kube-apiserver, kube-controller-manager - assume the key and certificate to be PEM-encoded.
97
97
98
98
## kube-apiserver configuration
99
99
The kube-apiserver has several requirements to enable TLS bootstrapping:
100
100
101
-
* Recognizing CA that signs the client certificate
101
+
* Recognizing CA that signs the client certificate
102
102
* Authenticating the bootstrapping kubelet to the `system:bootstrappers` group
103
103
* Authorize the bootstrapping kubelet to create a certificate signing request (CSR)
Bootstrap tokens are a simpler and more easily managed method to authenticate kubelets, and do not require any additional flags when starting kube-apiserver.
123
+
Bootstrap tokens are a simpler and more easily managed method to authenticate kubelets, and do not require any additional flags when starting kube-apiserver.
124
124
Using bootstrap tokens is currently __beta__ as of Kubernetes version 1.12.
125
125
126
126
Whichever method you choose, the requirement is that the kubelet be able to authenticate as a user with the rights to:
127
127
128
128
1. create and retrieve CSRs
129
-
2. be automatically approved to request node client certificates, if automatic approval is enabled.
129
+
2. be automatically approved to request node client certificates, if automatic approval is enabled.
130
130
131
131
A kubelet authenticating using bootstrap tokens is authenticated as a user in the group `system:bootstrappers`, which is the standard method to use.
132
132
@@ -152,7 +152,7 @@ From the kube-apiserver's perspective, however, the bootstrap token is special.
152
152
and grants anyone authenticating with that token special bootstrap rights, notably treating them as a member of the `system:bootstrappers` group. This fulfills a basic requirement
153
153
for TLS bootstrapping.
154
154
155
-
The details for creating the secret are available [here](/docs/reference/access-authn-authz/bootstrap-tokens/).
155
+
The details for creating the secret are available [here](/docs/reference/access-authn-authz/bootstrap-tokens/).
156
156
157
157
If you want to use bootstrap tokens, you must enable it on kube-apiserver with the flag:
158
158
@@ -161,7 +161,7 @@ If you want to use bootstrap tokens, you must enable it on kube-apiserver with t
161
161
```
162
162
163
163
#### Token authentication file
164
-
kube-apiserver has an ability to accept tokens as authentication.
164
+
kube-apiserver has an ability to accept tokens as authentication.
165
165
These tokens are arbitrary but should represent at least 128 bits of entropy derived
166
166
from a secure random number generator (such as `/dev/urandom` on most modern Linux
167
167
systems). There are multiple ways you can generate a token. For example:
@@ -252,8 +252,8 @@ RBAC permissions to the correct group.
252
252
253
253
There are two distinct sets of permissions:
254
254
255
-
*`nodeclient`: If a node is creating a new certificate for a node, then it does not have a certificate yet. It is authenticating using one of the tokens listed above, and thus is part of the group `system:bootstrappers`.
256
-
*`selfnodeclient`: If a node is renewing its certificate, then it already has a certificate (by definition), which it uses continuously to authenticate as part of the group `system:nodes`.
255
+
*`nodeclient`: If a node is creating a new certificate for a node, then it does not have a certificate yet. It is authenticating using one of the tokens listed above, and thus is part of the group `system:bootstrappers`.
256
+
*`selfnodeclient`: If a node is renewing its certificate, then it already has a certificate (by definition), which it uses continuously to authenticate as part of the group `system:nodes`.
257
257
258
258
To enable the kubelet to request and receive a new certificate, create a `ClusterRoleBinding` that binds the group in which the bootstrapping node is a member `system:bootstrappers` to the `ClusterRole` that grants it permission, `system:certificates.k8s.io:certificatesigningrequests:nodeclient`:
259
259
@@ -273,7 +273,7 @@ roleRef:
273
273
apiGroup: rbac.authorization.k8s.io
274
274
```
275
275
276
-
To enable the kubelet to renew its own client certificate, create a `ClusterRoleBinding` that binds the group in which the fully functioning node is a member `system:nodes` to the `ClusterRole` that
276
+
To enable the kubelet to renew its own client certificate, create a `ClusterRoleBinding` that binds the group in which the fully functioning node is a member `system:nodes` to the `ClusterRole` that
277
277
grants it permission, `system:certificates.k8s.io:certificatesigningrequests:selfnodeclient`:
278
278
279
279
```yml
@@ -382,7 +382,7 @@ To secure these, the kubelet can do one of:
382
382
* request serving certificates from the cluster server, via the CSR API
383
383
384
384
The client certificate provided by TLS bootstrapping is signed, by default, for `client auth` only, and thus cannot
385
-
be used as serving certificates, or `server auth`.
385
+
be used as serving certificates, or `server auth`.
386
386
387
387
However, you _can_ enable its server certificate, at least partially, via certificate rotation.
388
388
@@ -443,15 +443,3 @@ also manually approve certificate requests using kubectl. An administrator can
443
443
list CSRs with `kubectl get csr` and describe one in detail with `kubectl
444
444
describe csr <name>`. An administrator can approve or deny a CSR with `kubectl
445
445
certificate approve <name>` and `kubectl certificate deny <name>`.
446
-
447
-
448
-
## Limits
449
-
Although Kubernetes supports running control plane master components like kube-apiserver and kube-controller-manager in containers, and even as `Pod`s in a kubelet, as of this writing, you cannot both TLS Bootstrap a kubelet and run master plane components on it.
450
-
451
-
The reason for this limitation is that the kubelet attempts to bootstrap communication with kube-apiserver _before_ starting any pods, even static ones define on disk and referenced via the kubelet option `--pod-manifest-path=<PATH>`. Trying to do both TLS Bootstrapping and master components in kubelet leads to a race condition: kubelet needs to communicate to kube-apiserver to request certificates, yet requires those certificates to be available to start kube-apiserver.
452
-
453
-
An issue is open referencing this [here](https://github.com/kubernetes/kubernetes/issues/68686).
0 commit comments