Commit Graph

48 Commits (13b12e89408869c5b560a81e95bca33267bdb8e1)

Author SHA1 Message Date
Jeff Grafton efee0704c6 Autogenerate BUILD files 2017-12-23 13:12:11 -08:00
supereagle b694d51842 use versiond group clients from client-go 2017-11-07 14:47:22 +08:00
Clayton Coleman 5649f9a578 Move pkg/kubelet/util/csr into client-go
Everything else it depends on was already there, and now we have a
somewhat consistent code chain.
2017-10-16 16:05:48 +02:00
Clayton Coleman b3a11aa635
Have the certificate manager decide if the server is healthy
Prevent a Kubelet from shutting down when the server isn't responding to
us but we cannot get a new certificate. This allows a cluster to coast
if the master is unresponsive or a node is partitioned and their client
cert expires.
2017-10-16 14:27:03 +02:00
Clayton Coleman 7555dec82e
Kubelet should exit if the current client cert has expired
The client cert manager uses the most recent cert to request new
certificates. If that certificate is expired, it will be unable to
complete new CSR requests. This commit alters the manager to force
process exit if no further client cert rotation is possible, which
is expected to trigger a restart of the kubelet and either a
re-bootstrap from the bootstrap kubeconfig or a re-read of the
current disk state (assuming that some other agent is managing the
bootstrap configuration).

This prevents the Kubelet from wedging in a state where it cannot make
API calls.
2017-10-16 14:27:03 +02:00
Clayton Coleman 710dfb3427
Delete the private key for the bootstrap client cert on failure
Ensures that in a crash loop state we can make forward progress by
generating a new key and hence new CSR. If we do not delete the key, an
expired CSR may block startup.

Also more aggressively delete a bad cert path
2017-10-16 14:27:02 +02:00
Clayton Coleman ae6ee96b36
Verify the bootstrap client cert before using it
Before the bootstrap client is used, check a number of conditions that
ensure it can be safely loaded by the server. If any of those conditions
are invalid, re-bootstrap the node. This is primarily to force
bootstrapping without human intervention when a certificate is expired,
but also handles partial file corruption.
2017-10-16 14:26:56 +02:00
Jeff Grafton aee5f457db update BUILD files 2017-10-15 18:18:13 -07:00
Jacob Simpson 415c4d2c3a Move certificate manager to client. 2017-10-05 12:54:38 -07:00
hzxuzhonghu 00d703d4dc remove unused code 2017-09-26 16:39:21 +08:00
Jacob Simpson f1fef11b37 Add a kubelet metric to track certificate expiration. 2017-08-30 09:55:40 -07:00
Kubernetes Submit Queue 2c6cb24e8a Merge pull request #50303 from zouyee/newb
Automatic merge from submit-queue

delete ineffectual assginment

**What this PR does / why we need it**:
delete ineffectual assignment
**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #

**Special notes for your reviewer**:
2017-08-18 02:46:09 -07:00
Michael Taufen 24bab4c20f move KubeletConfiguration out of componentconfig API group 2017-08-15 08:12:42 -07:00
Jeff Grafton a7f49c906d Use buildozer to delete licenses() rules except under third_party/ 2017-08-11 09:32:39 -07:00
Jeff Grafton 33276f06be Use buildozer to remove deprecated automanaged tags 2017-08-11 09:31:50 -07:00
zouyee 847aa640b4 fix dump 2017-08-09 09:10:19 +08:00
Michael Taufen 443d58e40a Dynamic Kubelet Configuration
Alpha implementation of the Dynamic Kubelet Configuration feature.
See the proposal doc in #29459.
2017-08-08 12:21:37 -07:00
Malepati Bala Siva Sai Akhil f90a825308 Fix typo in certificate 2017-08-05 20:50:56 +05:30
xiangpengzhao f003ee9b29 Update OWNERS to correct members' handles. 2017-08-04 15:00:15 +08:00
Kubernetes Submit Queue 07ddb3941f Merge pull request #49899 from ericchiang/kubelet-close-conns-on-rotate
Automatic merge from submit-queue (batch tested with PRs 49237, 49656, 49980, 49841, 49899)

certificate manager: close existing client conns once cert rotates

After the kubelet rotates its client cert, it will keep connections to the API server open indefinitely, causing it to use its old credentials instead of the new certs. Because the API server authenticates client certs at the time of the request, and not the handshake, this could cause the kubelet to start hitting auth failures even if it rotated its certificate to a new, valid one.
    
When the kubelet rotates its cert, close down existing connections to force a new TLS handshake.

Ref https://github.com/kubernetes/features/issues/266
Updates https://github.com/kubernetes-incubator/bootkube/pull/663

```release-note
After a kubelet rotates its client cert, it now closes its connections to the API server to force a handshake using the new cert. Previously, the kubelet could keep its existing connection open, even if the cert used for that connection was expired and rejected by the API server.
```

/cc @kubernetes/sig-auth-bugs 
/assign @jcbsmpsn @mikedanese
2017-08-02 19:11:18 -07:00
Kubernetes Submit Queue 2495cc602f Merge pull request #49512 from bowei/cert-rotation-logging
Automatic merge from submit-queue (batch tested with PRs 49989, 49806, 49649, 49412, 49512)

Add some logs to certificate rotation

```release-note
NONE
```
2017-08-02 17:06:04 -07:00
Mike Danese 780e0eae3f rename OWNER to OWNERS 2017-08-01 17:44:10 -07:00
Eric Chiang 98795b32de generated:
Commands run:

	./hack/update-bazel.sh
2017-08-01 16:33:52 -07:00
Eric Chiang 11d96c174e certificate manager: close existing client conns once cert rotates
After the kubelet rotates its client cert, it will keep connections
to the API server open indefinitely, causing it to use its old
credentials instead of the new certs

When the kubelet rotates its cert, close down existing connections
to force a new TLS handshake.
2017-08-01 16:33:52 -07:00
Clayton Coleman 333536a68b
Move client cert bootstrap to a kubelet package
Makes it more clearly associated with the existing code and simplifies
cmd/kubelet/app.
2017-07-25 17:54:15 -04:00
Clayton Coleman 48236f0321
Move cmd/kubelet/app/bootstrap.go to a kubelet subpackage 2017-07-25 17:53:39 -04:00
Bowei Du 317fdec5ba Add some logs to certificate rotation 2017-07-24 12:15:19 -07:00
xiangpengzhao 01daf707c5 Refactor: pkg/util into sub-pkgs 2017-07-18 14:34:08 +08:00
Jacob Simpson 29c1b81d4c Scripted migration from clientset_generated to client-go. 2017-07-17 15:05:37 -07:00
Clayton Coleman b8e662fcea
Move the kubelet certificate management code into a single package
Code is very similar and belongs together.
2017-07-05 18:11:49 -04:00
Chao Xu 60604f8818 run hack/update-all 2017-06-22 11:31:03 -07:00
Chao Xu cde4772928 run ./root-rewrite-all-other-apis.sh, then run make all, pkg/... compiles 2017-06-22 11:30:52 -07:00
Kubernetes Submit Queue cfdbc9c028 Merge pull request #46731 from rmmh/test-only-once
Automatic merge from submit-queue

Don't rerun certificate manager tests 1000 times.

**What this PR does / why we need it**:
Running every testcase 1000 times needlessly bloats the logs.

**Release note**:
```release-note
NONE
```
2017-06-19 17:13:06 -07:00
Ryan Hitchman 49987707a7 Don't rerun certificate manager tests as subtests 1000 times.
Instead, run the core verification repeatedly.
2017-06-06 13:32:04 -07:00
Jacob Simpson 1519bb94dc Rotate kubelet client certificate.
Changes the kubelet so it bootstraps off the cert/key specified in the
config file and uses those to request new cert/key pairs from the
Certificate Signing Request API, as well as rotating client certificates
when they approach expiration.
2017-06-01 09:29:42 -07:00
Kubernetes Submit Queue f2074ba8de Merge pull request #45059 from jcbsmpsn/rotate-server-certificate
Automatic merge from submit-queue (batch tested with PRs 46635, 45619, 46637, 45059, 46415)

Certificate rotation for kubelet server certs.

Replaces the current kubelet server side self signed certs with certs signed by
the Certificate Request Signing API on the API server. Also renews expiring
kubelet server certs as expiration approaches.

Two Points:
1. With `--feature-gates=RotateKubeletServerCertificate=true` set, the kubelet will
    request a certificate during the boot cycle and pause waiting for the request to
    be satisfied.
2. In order to have the kubelet's certificate signing request auto approved,
    `--insecure-experimental-approve-all-kubelet-csrs-for-group=` must be set on
    the cluster controller manager. There is an improved mechanism for auto
    approval [proposed](https://github.com/kubernetes/kubernetes/issues/45030).

**Release note**:
```release-note
With `--feature-gates=RotateKubeletServerCertificate=true` set, the kubelet will
request a server certificate from the API server during the boot cycle and pause
waiting for the request to be satisfied. It will continually refresh the certificate as
the certificates expiration approaches.
```
2017-05-30 19:49:02 -07:00
Kubernetes Submit Queue e0a6cde6f4 Merge pull request #46647 from mikedanese/kubelet-certs-approver
Automatic merge from submit-queue

add myself and liggitt to pkg/kubelet/certificats OWNERs

For as long a kubelet is using the internal client, this certificate
manager is bound to the kubelet. Once kubelet has moved to client-go we
plan to extract this library to be general purpose. In the meantime,
liggitt and I should handle reviews of this code.

@liggitt @timstclair
2017-05-30 16:41:55 -07:00
Mike Danese 5920e48333 add myself and liggitt to pkg/kubelet/certificats OWNERs
For as long a kubelet is using the internal client, this certificate
manager is bound to the kubelet. Once kubelet has moved to client-go we
plan to extract this library to be general purpose. In the meantime,
liggitt and I should handle reviews of this code.
2017-05-30 15:07:02 -07:00
Jacob Simpson 93c9aded40 Attempt certificate rotation as expiration approaches. 2017-05-29 12:28:16 -07:00
Jacob Simpson 4c22e6bc6a Certificate rotation for kubelet server certs.
Replaces the current kubelet server side self signed certs with certs
signed by the Certificate Request Signing API on the API server. Also
renews expiring kubelet server certs as expiration approaches.
2017-05-29 12:28:01 -07:00
Jacob Simpson de23d3fd00 Allow certificate manager to be initialized with client.
Add test coverage to the certificate manager covering the initialization
scenario where it is initialized with no Certificate Request Signing
client, then the client is added later. This matches how it will be used
when the Certificate Request Signing client is also the consumer of the
certificate manager.
2017-05-12 13:53:37 -07:00
Jacob Simpson a926c1f258 Allow certificate manager to be initialized with no certs.
Adds support to the certificate manager so it can be initialized with no
certs and only a connection to the certificate request signing API. This
specifically covers the scenario for the kubelet server certificate,
where there is a request signing client but on first boot there is no
bootstrapping or local certs.
2017-05-01 17:36:33 -07:00
Jacob Simpson ac171f69f7 Restructure unit tests for more cert/keys. 2017-04-28 17:13:48 -07:00
Jacob Simpson e992eaec8f Add bootstrap support to certificate manager. 2017-04-20 16:27:32 -07:00
Kubernetes Submit Queue 4e3bbe3915 Merge pull request #42498 from jcbsmpsn/add-jitter-to-rotation-threshold
Automatic merge from submit-queue (batch tested with PRs 44364, 44361, 42498)

Fix the certificate rotation threshold and add jitter.

Adjusts the certificate rotation threshold to be fixed, with some jitter to
spread out the load on the Certificate Signing Request API. The rotation
threshold is fixed at 20% now, meaning when 20% of the certificate's total
duration is remaining, the certificate manager will attempt to rotate, with
jitter +/-10%. For certificates of duration 1 month that means they will
rotate after 24 days, +/- 3 days.

On a 6000 node cluster, assuming all nodes added at nearly the same time, this
should result in 6000 nodes rotating spread over 6 days (total range of the
jitter), or ~42 nodes / hour requesting new certificates.
2017-04-14 17:56:01 -07:00
Mike Danese a05c3c0efd autogenerated 2017-04-14 10:40:57 -07:00
Jacob Simpson e7666648bf Fix the certificate rotation threshold and add jitter. 2017-04-11 09:20:16 -07:00
Jacob Simpson 855627e5cb Rotate the kubelet certificate when about to expire.
Changes the kubelet so it doesn't use the cert/key files directly for
starting the TLS server. Instead the TLS server reads the cert/key from
the new CertificateManager component, which is responsible for
requesting new certificates from the Certificate Signing Request API on
the API Server.
2017-02-17 17:42:35 -08:00