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

feat: create kubelet certificates on controlplane #4325

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sergelogvinov
Copy link
Sponsor Contributor

@sergelogvinov sergelogvinov commented Oct 4, 2021

This PR solves two problems:

  1. kubelet can connect to the kube-api if node name was changed (dhcp tricks)
  2. health check error message if rotate-server-certificates is true

Result

192.168.10.11   drwx------   212       Oct  4 20:26:35   .
192.168.10.11   -rw-------   850       Oct  4 20:24:12   kubelet-client-2021-10-04-20-24-12.pem
192.168.10.11   Lrwxrwxrwx   59        Oct  4 20:24:12   kubelet-client-current.pem -> /var/lib/kubelet/pki/kubelet-client-2021-10-04-20-24-12.pem
192.168.10.11   -rw-------   891       Oct  4 20:24:12   kubelet-server-2021-10-04-20-24-12.pem
192.168.10.11   -rw-------   919       Oct  4 20:26:35   kubelet-server-2021-10-04-20-26-35.pem
192.168.10.11   Lrwxrwxrwx   59        Oct  4 20:26:35   kubelet-server-current.pem -> /var/lib/kubelet/pki/kubelet-server-2021-10-04-20-26-35.pem

Second kubelet-server-2021-10-04-20-26-35.pem file was rotated by kubelet.

Acceptance

Please use the following checklist:

  • you linked an issue (if applicable)
  • you included tests (if applicable)
  • you ran conformance (make conformance)
  • you formatted your code (make fmt)
  • you linted your code (make lint)
  • you generated documentation (make docs)
  • you ran unit-tests (make unit-tests)

See make help for a description of the available targets.


This change is Reviewable

Contolplane has root certificate and Talos can create kubelet
client/server certificat at boot time.

Signed-off-by: Serge Logvinov <serge.logvinov@sinextra.dev>
}

kubeletClientKeyPair, err := x509.NewKeyPair(ca,
x509.CommonName(constants.KubernetesKubeletCommonNamePrefix+nodename),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

evaluating certificates using Common Names is common... but discouraged. And some go libraries will actually migrate away from doing that. I suggest you instead rely on setting a SubjectAltName instead to avoid future problems.

@JAORMX
Copy link

JAORMX commented Feb 19, 2022

Is there a proposal for this feature that describes the overall flow better? I'd like to know the plan for cert rotation which tends to be an issue

@smira
Copy link
Member

smira commented Feb 21, 2022

Is there a proposal for this feature that describes the overall flow better? I'd like to know the plan for cert rotation which tends to be an issue

Right now Talos doesn't manage kubelet certificates, and kubelet rotates the certificates on its own.

We plan on taking over kubelet certificate management as part of bigger change to improve the node join security.

@JAORMX
Copy link

JAORMX commented Feb 21, 2022

Is there a proposal for this feature that describes the overall flow better? I'd like to know the plan for cert rotation which tends to be an issue

Right now Talos doesn't manage kubelet certificates, and kubelet rotates the certificates on its own.

We plan on taking over kubelet certificate management as part of bigger change to improve the node join security.

that sounds like a good idea! I'd be happy to review if it helps.

Copy link

github-actions bot commented Jul 4, 2024

This PR is stale because it has been open 45 days with no activity.

@github-actions github-actions bot added the Stale label Jul 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants