Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release-1.27] Backports for 2024-04 release cycle #9912

Merged
merged 16 commits into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cmd/cert/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ func main() {
app := cmds.NewApp()
app.Commands = []cli.Command{
cmds.NewCertCommands(
cert.Check,
cert.Rotate,
cert.RotateCA,
),
Expand Down
1 change: 1 addition & 0 deletions cmd/k3s/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ func main() {
cmds.NewCertCommands(
certCommand,
certCommand,
certCommand,
),
cmds.NewCompletionCommand(internalCLIAction(version.Program+"-completion", dataDir, os.Args)),
}
Expand Down
1 change: 1 addition & 0 deletions cmd/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ func main() {
secretsencrypt.Reencrypt,
),
cmds.NewCertCommands(
cert.Check,
cert.Rotate,
cert.RotateCA,
),
Expand Down
30 changes: 30 additions & 0 deletions docs/adrs/cert-expiry-checks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Add Support for Checking and Alerting on Certificate Expiry

Date: 2024-03-26

## Status

Accepted

## Context

The certificates generated by K3s have two lifecycles:
* Certificate authority certificates expire 3650 days (roughly 10 years) from their moment of issuance.
The CA certificates are not automatically renewed, and require manual intervention to extend their validity.
* Leaf certificates (client and server certs) expire 365 days (roughly 1 year) from their moment of issuance.
The certificates are automatically renewed if they are within 90 days of expiring at the time K3s starts.

K3s does not currently expose any information about certificate validity.
There are no metrics, CLI tools, or events that an administrator can use to track when certificates must be renewed or rotated to avoid outages when certificates expire.
The best we can do at the moment is recommend that administrators either restart their nodes regularly to ensure that certificates are renewed within the 90 day window, or manually rotate their certs yearly.

We do not have any guidance around renewing the CA certs, which will be a major undertaking for users as their clusters approach the 10-year mark. We currently have a bit of runway on this issue, as K3s has not been around for 10 years.

## Decision

* K3s will add a CLI command to print certificate validity. It will be grouped alongside the command used to rotate the leaf certificates (`k3s certificate rotate`).
* K3s will add an internal controller that maintains metrics for certificate expiration, and creates Events when certificates are about to or have expired.

## Consequences

This will require additional documentation, CLI subcommands, and QA work to validate the process steps.
40 changes: 22 additions & 18 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ go 1.21

replace (
github.com/Microsoft/hcsshim => github.com/Microsoft/hcsshim v0.11.0
github.com/Mirantis/cri-dockerd => github.com/k3s-io/cri-dockerd v0.3.9-k3s1 // k3s/release-1.27
github.com/Mirantis/cri-dockerd => github.com/k3s-io/cri-dockerd v0.3.12-k3s1.27 // k3s/release-1.27
github.com/cloudnativelabs/kube-router/v2 => github.com/k3s-io/kube-router/v2 v2.0.1
github.com/containerd/containerd => github.com/k3s-io/containerd v1.7.11-k3s2.27
github.com/docker/distribution => github.com/docker/distribution v2.8.2+incompatible
github.com/docker/docker => github.com/docker/docker v24.0.0-rc.2.0.20230801142700-69c9adb7d386+incompatible
github.com/containerd/containerd => github.com/k3s-io/containerd v1.7.15-k3s1.27
github.com/docker/distribution => github.com/docker/distribution v2.8.3+incompatible
github.com/docker/docker => github.com/docker/docker v24.0.8+incompatible
github.com/emicklei/go-restful/v3 => github.com/emicklei/go-restful/v3 v3.9.0
github.com/golang/protobuf => github.com/golang/protobuf v1.5.4
github.com/googleapis/gax-go/v2 => github.com/googleapis/gax-go/v2 v2.1.1
Expand Down Expand Up @@ -94,8 +94,8 @@ require (
github.com/containerd/aufs v1.0.0
github.com/containerd/cgroups/v3 v3.0.2
github.com/containerd/containerd v1.7.14
github.com/containerd/fuse-overlayfs-snapshotter v1.0.5
github.com/containerd/stargz-snapshotter v0.14.4-0.20230913082252-7275d45b185c
github.com/containerd/fuse-overlayfs-snapshotter v1.0.8
github.com/containerd/stargz-snapshotter v0.15.1
github.com/containerd/zfs v1.1.0
github.com/coreos/go-iptables v0.7.0
github.com/coreos/go-systemd/v22 v22.5.0
Expand All @@ -109,7 +109,7 @@ require (
github.com/go-test/deep v1.0.7
github.com/golang/mock v1.6.0
github.com/google/cadvisor v0.47.2
github.com/google/uuid v1.4.0
github.com/google/uuid v1.6.0
github.com/gorilla/mux v1.8.1
github.com/gorilla/websocket v1.5.1
github.com/ipfs/go-ds-leveldb v0.5.0
Expand All @@ -131,6 +131,7 @@ require (
github.com/opencontainers/selinux v1.11.0
github.com/otiai10/copy v1.7.0
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.19.0
github.com/rancher/dynamiclistener v0.3.6
github.com/rancher/lasso v0.0.0-20230830164424-d684fdeb6f29
github.com/rancher/remotedialer v0.3.0
Expand All @@ -155,18 +156,19 @@ require (
golang.org/x/net v0.21.0
golang.org/x/sync v0.6.0
golang.org/x/sys v0.18.0
google.golang.org/grpc v1.60.1
google.golang.org/grpc v1.62.0
gopkg.in/yaml.v2 v2.4.0
inet.af/tcpproxy v0.0.0-20200125044825-b6bb9b5b8252
k8s.io/api v0.28.8
k8s.io/apimachinery v0.28.8
k8s.io/apiserver v0.27.12
k8s.io/cli-runtime v0.22.2
k8s.io/client-go v11.0.1-0.20190409021438-1a26190bd76a+incompatible
k8s.io/cloud-provider v0.27.12
k8s.io/cluster-bootstrap v0.0.0
k8s.io/component-base v0.27.12
k8s.io/component-helpers v0.27.12
k8s.io/cri-api v0.29.0-alpha.0
k8s.io/cri-api v0.29.0-alpha.2
k8s.io/klog/v2 v2.100.1
k8s.io/kube-proxy v0.0.0
k8s.io/kubectl v0.25.0
Expand All @@ -178,6 +180,7 @@ require (
require (
cloud.google.com/go/compute v1.23.3 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
dario.cat/mergo v1.0.0 // indirect
github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 // indirect
github.com/AdamKorcz/go-118-fuzz-build v0.0.0-20230306123547-8075edf89bb0 // indirect
github.com/Azure/azure-sdk-for-go v56.3.0+incompatible // indirect
Expand Down Expand Up @@ -214,19 +217,18 @@ require (
github.com/checkpoint-restore/go-criu/v5 v5.3.0 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
github.com/cilium/ebpf v0.9.1 // indirect
github.com/container-orchestrated-devices/container-device-interface v0.5.4 // indirect
github.com/container-storage-interface/spec v1.7.0 // indirect
github.com/containerd/btrfs/v2 v2.0.0 // indirect
github.com/containerd/cgroups v1.1.0 // indirect
github.com/containerd/console v1.0.3 // indirect
github.com/containerd/continuity v0.4.2 // indirect
github.com/containerd/continuity v0.4.3 // indirect
github.com/containerd/fifo v1.1.0 // indirect
github.com/containerd/go-cni v1.1.9 // indirect
github.com/containerd/go-runc v1.0.0 // indirect
github.com/containerd/imgcrypt v1.1.7 // indirect
github.com/containerd/log v0.1.0 // indirect
github.com/containerd/nri v0.4.0 // indirect
github.com/containerd/stargz-snapshotter/estargz v0.14.3 // indirect
github.com/containerd/nri v0.6.0 // indirect
github.com/containerd/stargz-snapshotter/estargz v0.15.1 // indirect
github.com/containerd/ttrpc v1.2.3 // indirect
github.com/containerd/typeurl v1.0.2 // indirect
github.com/containerd/typeurl/v2 v2.1.1 // indirect
Expand All @@ -241,7 +243,8 @@ require (
github.com/daviddengcn/go-colortext v1.0.0 // indirect
github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
github.com/docker/cli v24.0.5+incompatible // indirect
github.com/distribution/reference v0.5.0 // indirect
github.com/docker/cli v24.0.7+incompatible // indirect
github.com/docker/distribution v2.8.3+incompatible // indirect
github.com/docker/docker-credential-helpers v0.7.0 // indirect
github.com/docker/go-connections v0.5.0 // indirect
Expand Down Expand Up @@ -298,7 +301,7 @@ require (
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect
github.com/hanwen/go-fuse/v2 v2.3.0 // indirect
github.com/hanwen/go-fuse/v2 v2.4.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
Expand Down Expand Up @@ -374,6 +377,7 @@ require (
github.com/moby/sys/sequential v0.5.0 // indirect
github.com/moby/sys/signal v0.7.0 // indirect
github.com/moby/sys/symlink v0.2.0 // indirect
github.com/moby/sys/user v0.1.0 // indirect
github.com/moby/term v0.0.0-20221205130635-1aeaba878587 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
Expand Down Expand Up @@ -413,7 +417,6 @@ require (
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/polydawn/refmt v0.89.0 // indirect
github.com/pquerna/cachecontrol v0.1.0 // indirect
github.com/prometheus/client_golang v1.19.0 // indirect
github.com/prometheus/client_model v0.6.0 // indirect
github.com/prometheus/common v0.48.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
Expand Down Expand Up @@ -484,7 +487,7 @@ require (
gonum.org/v1/gonum v0.13.0 // indirect
google.golang.org/api v0.152.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto v0.0.0-20231106174013-bbf56f31fb17 // indirect
google.golang.org/genproto v0.0.0-20240123012728-ef4313101c80 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/gcfg.v1 v1.2.3 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
Expand All @@ -494,7 +497,6 @@ require (
gopkg.in/warnings.v0 v0.1.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apiextensions-apiserver v0.25.4 // indirect
k8s.io/cli-runtime v0.22.2 // indirect
k8s.io/code-generator v0.25.4 // indirect
k8s.io/controller-manager v0.25.4 // indirect
k8s.io/csi-translation-lib v0.0.0 // indirect
Expand All @@ -517,4 +519,6 @@ require (
sigs.k8s.io/kustomize/kustomize/v5 v5.0.1 // indirect
sigs.k8s.io/kustomize/kyaml v0.14.1 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.3.0 // indirect
tags.cncf.io/container-device-interface v0.6.2 // indirect
tags.cncf.io/container-device-interface/specs-go v0.6.0 // indirect
)
Loading
Loading