-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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
leases: add more details on API Server Identity #38196
Conversation
👷 Deploy Preview for kubernetes-io-vnext-staging processing.
|
@andrewsykim: GitHub didn't allow me to assign the following users: mo. Note that only kubernetes members with read permissions, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time. In response to this: Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
``` | ||
|
||
The SHA256 hash used in the lease name is based on the OS hostname as seen by kube-apiserver. Each kube-apiserver should be | ||
configured to use a hostname that is unique within the cluster. New instances of kube-apiserver that use the same hostname |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we document the use of the kubernetes.io/hostname
label as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #38196 (comment)
Oops. This is the follow up PR! |
We should get a tech review on this one. |
8eddedf
to
4580cd5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One minor nit.
``` | ||
$ kubectl -n kube-system get lease kube-apiserver-c4vwjftbvpc5os2vvzle4qg27a -o yaml | ||
apiVersion: coordination.k8s.io/v1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you split this into two code blocks, one with shell
syntax, the other with yaml
syntax?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done!
Signed-off-by: Andrew Sy Kim <[email protected]>
4580cd5
to
917dee9
Compare
/lgtm |
LGTM label has been added. Git tree hash: 0d317e8f2d3291f5808b70ae78582ebba14fdca9
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some more feedback (see inline comments)
The label k8s.io/component
is not registered. Please document it in https://kubernetes.io/docs/reference/labels-annotations-taints/
(if feasible: switch to using control-plane.kubernetes.io/component
, before the v1.26 release, so that end users don't confuse it with the app.kubernetes.io/component
label).
We can also release with this and then deprecate k8s.io/component
in v1.27 but that's a bit of a shame to have to do.
Optionally, document what happens when an API server runs as a Pod (eg for nesting a control plane).
That might be best saved for a post-release blog for the release when this feature graduates to stable.
$ kubectl -n kube-system get lease -l k8s.io/component=kube-apiserver | ||
NAME HOLDER AGE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please split this - see don't include the command prompt and separate commands from output.
kube-apiserver-fyloo45sdenffw2ugwaz3likua kube-apiserver-fyloo45sdenffw2ugwaz3likua_c5ffa286-8a9a-45d4-91e7-61118ed58d2e 4m43s | ||
``` | ||
|
||
The SHA256 hash used in the lease name is based on the OS hostname as seen by kube-apiserver. Each kube-apiserver should be |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which is true:
The SHA256 hash used in the lease name is based on the OS hostname as seen by kube-apiserver. Each kube-apiserver should be | |
The SHA256 hash used in the Lease name is based on the OS hostname as seen by kube-apiserver. | |
The API server coerces its hostname string to lowercase before hashing it. Each kube-apiserver | |
should be |
or
The SHA256 hash used in the lease name is based on the OS hostname as seen by kube-apiserver. Each kube-apiserver should be | |
The SHA256 hash used in the Lease name is based on the OS hostname as seen by kube-apiserver. | |
Each kube-apiserver should be |
?
creationTimestamp: "2022-11-30T15:37:15Z" | ||
labels: | ||
k8s.io/component: kube-apiserver | ||
kubernetes.io/hostname: kind-control-plane |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://kubernetes.io/docs/reference/labels-annotations-taints/ lists that this label is used on Nodes (only)
Either:
- fix the Kubernetes code not to label Leases with this official label
- allowed, but a bit weird to make up a new one that is so similar
- update https://kubernetes.io/docs/reference/labels-annotations-taints/ to record that it is also used for leases that are associated with nodes
|
||
The SHA256 hash used in the lease name is based on the OS hostname as seen by kube-apiserver. Each kube-apiserver should be | ||
configured to use a hostname that is unique within the cluster. New instances of kube-apiserver that use the same hostname | ||
will take over existing Leases using a new holder identity, as opposed to instantiating new lease objects. You can check the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(nit)
will take over existing Leases using a new holder identity, as opposed to instantiating new lease objects. You can check the | |
will take over existing Leases using a new holder identity, as opposed to instantiating new Leases. | |
You can check the |
spec: | ||
holderIdentity: kube-apiserver-c4vwjftbvpc5os2vvzle4qg27a_9cbf54e5-1136-44bd-8f9a-1dcd15c346b4 | ||
leaseDurationSeconds: 3600 | ||
renewTime: "2022-11-30T18:04:27.912073Z" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(nit) Ideally, pick a date that is close to the v1.26 release.
discover how many instances of `kube-apiserver` are operating the Kubernetes control plane. | ||
Existence of kube-apiserver leases enables future capabilities that may require coordination between | ||
each kube-apiserver. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
discover how many instances of `kube-apiserver` are operating the Kubernetes control plane. | |
Existence of kube-apiserver leases enables future capabilities that may require coordination between | |
each kube-apiserver. | |
The API server creates these leases in the `kube-system` namespace. | |
The existence of kube-apiserver Leases also enables adding future capabilities to Kubernetes, | |
that may require coordination between each kube-apiserver (for example, during cluster | |
upgrades). |
@@ -38,3 +38,43 @@ rest of the system. While not particularly useful on its own, this provides a me | |||
discover how many instances of `kube-apiserver` are operating the Kubernetes control plane. | |||
Existence of kube-apiserver leases enables future capabilities that may require coordination between | |||
each kube-apiserver. | |||
|
|||
You can inspect Leases owned by each kube-apiserver by checking for lease objects in the `kube-system` namespace |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(nit)
You can inspect Leases owned by each kube-apiserver by checking for lease objects in the `kube-system` namespace | |
You can inspect Leases owned by each kube-apiserver by checking for Leases in the `kube-system` namespace |
apiVersion: coordination.k8s.io/v1 | ||
kind: Lease | ||
metadata: | ||
creationTimestamp: "2022-11-30T15:37:15Z" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(nit) Ideally, pick a date that is close to the v1.26 release.
renewTime: "2022-11-30T18:04:27.912073Z" | ||
``` | ||
|
||
Expired leases from kube-apiservers that no longer exist are garbage collected by new kube-apiservers after 1 hour. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this right:
Expired leases from kube-apiservers that no longer exist are garbage collected by new kube-apiservers after 1 hour. | |
### API server Lease garbage collection | |
Expired Leases from kube-apiservers that no longer exist are garbage collected by live kube-apiservers. | |
The control plane leaves the expired Leases for at least one hour before removing them. |
?
We should update https://kubernetes.io/docs/concepts/architecture/garbage-collection/ to link to that heading, which is why I added it.
Good enough for alpha, I reckon. /approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: sftim The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Except the feature is beta 😂 |
More polish is welcome. |
Signed-off-by: Andrew Sy Kim [email protected]
Follow-up to #37921 (comment)