Production-Grade Container Scheduling and Management
Go to file
Jack Kleeman 929b1559a0 Add ReloadCertFromDisk flag to rest.Config and to kubeconfig which allows the provided client certificate files to be reloaded from disk (currently on every use)
Close outbound connections when using a cert callback and certificates rotate. This means that we won't get into a situation where we have open TLS connections using expires certs, which would get unauthorized errors at the apiserver

Attempt to retrieve a new certificate if open connections near expiry, to prevent the case where the cert expires but we haven't yet opened a new TLS connection and so GetClientCertificate hasn't been called.

Move certificate rotation logic to a separate function

Rely on generic transport approach to handle closing TLS client connections in exec plugin; no need to use a custom dialer as this is now the default behaviour of the transport when faced with a cert callback. As a result of handling this case, it is now safe to apply the transport approach even in cases where there is a custom Dialer (this will not affect kubelet connrotation behaviour, because that uses a custom transport, not just a dialer).

Check expiry of the full TLS certificate chain that will be presented, not only the leaf. Only do this check when the certificate actually rotates. Start the certificate as a zero value, not nil, so that we don't see a rotation when there is in fact no client certificate

Drain the timer when we first initialize it, to prevent immediate rotation. Additionally, calling Stop() on the timer isn't necessary.

Don't close connections on the first 'rotation'

Remove RotateCertFromDisk and RotateClientCertFromDisk flags.

Instead simply default to rotating certificates from disk whenever files are exclusively provided.

Add integration test for client certificate rotation

Simplify logic; rotate every 5 mins

Instead of trying to be clever and checking for rotation just before an
expiry, let's match the logic of the new apiserver cert rotation logic
as much as possible. We write a controller that checks for rotation
every 5 mins. We also check on every new connection.

Respond to review

Fix kubelet certificate rotation logic

The kubelet rotation logic seems to be broken because it expects its
cert files to end up as cert data whereas in fact they end up as a
callback. We should just call the tlsConfig GetCertificate callback
as this obtains a current cert even in cases where a static cert is
provided, and check that for validity.

Later on we can refactor all of the kubelet logic so that all it does is
write files to disk, and the cert rotation work does the rest.

Only read certificates once a second at most

Respond to review

1) Don't blat the cert file names
2) Make it more obvious where we have a neverstop
3) Naming
4) Verbosity

Avoid cache busting

Use filenames as cache keys when rotation is enabled, and add the
rotation later in the creation of the transport.

Caller should start the rotating dialer

Add continuous request rotation test

Rebase: use context in List/Watch

Swap goroutine around

Retry GETs on net.IsProbableEOF

Refactor certRotatingDialer

For simplicity, don't affect cert callbacks

To reduce change surface, lets not try to handle the case of a changing
GetCert callback in this PR. Reverting this commit should be sufficient
to handle that case in a later PR.

This PR will focus only on rotating certificate and key files.
Therefore, we don't need to modify the exec auth plugin.

Fix copyright year
2020-03-02 17:20:16 +00:00
.github Add kind/flake issue template 2019-12-09 16:06:17 -08:00
api Merge pull request #88503 from robscott/app-protocol 2020-02-26 00:20:40 -08:00
build update coredns to 1.6.7 2020-02-24 15:00:55 -05:00
CHANGELOG CHANGELOG: Update CHANGELOG-1.18.md 2020-02-13 09:35:11 -05:00
cluster Create OWNERS file for cluster/log-dump 2020-02-25 13:12:54 +01:00
cmd Merge pull request #84913 from serathius/metrics-scheduler 2020-02-25 21:02:26 -08:00
docs Updated OWNERS files to include link to docs 2019-02-04 22:33:12 +01:00
Godeps vendor network proxy client 2020-02-20 10:19:38 -08:00
hack Merge pull request #88476 from ingvagabund/allow-to-override-test-benchtime 2020-02-24 21:38:48 -08:00
logo Correct URL 2019-04-28 00:05:57 -04:00
pkg Merge pull request #88503 from robscott/app-protocol 2020-02-26 00:20:40 -08:00
plugin Merge pull request #80724 from cceckman/provider-info-e2e 2020-02-13 01:38:35 -08:00
staging Add ReloadCertFromDisk flag to rest.Config and to kubeconfig which allows the provided client certificate files to be reloaded from disk (currently on every use) 2020-03-02 17:20:16 +00:00
test Add ReloadCertFromDisk flag to rest.Config and to kubeconfig which allows the provided client certificate files to be reloaded from disk (currently on every use) 2020-03-02 17:20:16 +00:00
third_party Merge pull request #83385 from daxmc99/docstring-change 2019-11-08 13:48:11 -08:00
translations Move pkg/kubectl/cmd/util and subdirs to staging 2019-07-29 13:08:41 -07:00
vendor apiextions: add list-type: map|set CR validation 2020-02-25 18:34:49 +01:00
.bazelrc move build related files out of the root directory 2017-05-15 15:53:54 -07:00
.bazelversion Add .bazelversion file 2019-09-19 08:57:12 +02:00
.generated_files fix path to prow size plugin 2019-07-18 14:41:26 +02:00
.gitattributes review staging go.mod files 2019-05-10 15:40:43 -04:00
.gitignore openapi: commit low-change code-gen+sample-apiserver specs 2019-07-12 21:04:06 +02:00
.kazelcfg.json Switch from gazel to kazel, and move kazelcfg into build/root 2017-07-18 12:48:51 -07:00
BUILD.bazel move build related files out of the root directory 2017-05-15 15:53:54 -07:00
CHANGELOG.md CHANGELOG: Move changelog, soft-link to top-level, refresh listing 2020-02-06 01:04:44 -05:00
code-of-conduct.md Update code-of-conduct.md 2017-12-20 13:33:36 -05:00
CONTRIBUTING.md Pointed to community/contributors/guide/README.md 2017-12-15 22:08:34 +05:30
go.mod update corefile-migration library to 1.0.6 2020-02-24 15:00:55 -05:00
go.sum update corefile-migration library to 1.0.6 2020-02-24 15:00:55 -05:00
LICENSE
Makefile move build related files out of the root directory 2017-05-15 15:53:54 -07:00
Makefile.generated_files move build related files out of the root directory 2017-05-15 15:53:54 -07:00
OWNERS Move jbeda to emeritus status. 2019-10-11 17:46:18 -04:00
OWNERS_ALIASES Merge pull request #88116 from justaugustus/releng-owners 2020-02-14 04:22:17 -08:00
README.md Make k8s.io/kubernetes dependency policy explicit 2019-10-30 10:53:02 -04:00
SECURITY_CONTACTS Update SECURITY_CONTACTS with current PSC 2019-05-29 15:22:35 +05:30
SUPPORT.md delete all duplicate empty blanks 2019-02-23 10:28:04 +08:00
WORKSPACE move build related files out of the root directory 2017-05-15 15:53:54 -07:00

Kubernetes

GoDoc Widget CII Best Practices


Kubernetes is an open source system for managing containerized applications across multiple hosts. It provides basic mechanisms for deployment, maintenance, and scaling of applications.

Kubernetes builds upon a decade and a half of experience at Google running production workloads at scale using a system called Borg, combined with best-of-breed ideas and practices from the community.

Kubernetes is hosted by the Cloud Native Computing Foundation (CNCF). If your company wants to help shape the evolution of technologies that are container-packaged, dynamically scheduled, and microservices-oriented, consider joining the CNCF. For details about who's involved and how Kubernetes plays a role, read the CNCF announcement.


To start using Kubernetes

See our documentation on kubernetes.io.

Try our interactive tutorial.

Take a free course on Scalable Microservices with Kubernetes.

To use Kubernetes code as a library in other applications, see the list of published components. Use of the k8s.io/kubernetes module or k8s.io/kubernetes/... packages as libraries is not supported.

To start developing Kubernetes

The community repository hosts all information about building Kubernetes from source, how to contribute code and documentation, who to contact about what, etc.

If you want to build Kubernetes right away there are two options:

You have a working Go environment.
mkdir -p $GOPATH/src/k8s.io
cd $GOPATH/src/k8s.io
git clone https://github.com/kubernetes/kubernetes
cd kubernetes
make
You have a working Docker environment.
git clone https://github.com/kubernetes/kubernetes
cd kubernetes
make quick-release

For the full story, head over to the developer's documentation.

Support

If you need support, start with the troubleshooting guide, and work your way through the process that we've outlined.

That said, if you have questions, reach out to us one way or another.

Analytics