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

Add script to quickly deploy kind cluster with custom KNP image #631

Merged
merged 7 commits into from
Jun 20, 2024

Conversation

carreter
Copy link
Contributor

Thought I'd share a script I wrote while setting up my local dev environment.

./quickstart-kind.sh lets you set how many KCP + worker nodes the cluster has, modify which image is pulled for both the proxy server and agent, and optionally sideload the images into the cluster to avoid the need for a publishing the image on a public or local registry.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jun 12, 2024
@k8s-ci-robot
Copy link
Contributor

Hi @carreter. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jun 12, 2024
@carreter
Copy link
Contributor Author

@avrittrohwer for visibility :)

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jun 12, 2024
@jkh52
Copy link
Contributor

jkh52 commented Jun 13, 2024

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 13, 2024
@carreter
Copy link
Contributor Author

/retest

- operator: "Exists"
effect: "NoExecute"
nodeSelector:
kubernetes.io/os: linux
Copy link
Contributor

Choose a reason for hiding this comment

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

Could add node-role.kubernetes.io/worker: '' to prevent agents on control plane nodes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, seems like setting this label on the node in the kind.config breaks the cluster for some reason. kind doesn't label the worker nodes as such by default for some reason, and kubelet doesn't start if I provide a custom role label. Leaving this out for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Did some more testing and opened an upstream issue: kubernetes-sigs/kind#3657

Copy link
Member

Choose a reason for hiding this comment

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

kubelet doesn't permit adding arbitrary lables in the k8s.io / kubernetes.io namespace because those are reserved for Kubernetes and need to be approved by the API review team.

You can instead use taints and tolerations to schedule only to worker nodes.

Kind removes the control plane taint only if there is a single control plane node and no other nodes (so a one node cluster), otherwise the control plane node(s) are tainted, see:
https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/#control-plane-node-isolation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jkh52 Is it ok if I leave this as-is? I haven't noticed proxy agents getting spun up on the control plane anyway.

Copy link
Contributor

Choose a reason for hiding this comment

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

No objections. Are taints + tolerations the reason that you don't see agents on control plane? Did you try a one-node cluster as well?

Copy link
Member

Choose a reason for hiding this comment

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

On a one-node cluster, that node is the worker and the control plane host, so scheduling user workloads and control plane workloads would be expected, though I'm not sure it makes sense to even try deploying this application to a one node cluster ..?

On a multi-node cluster there's the well-known kubeadm taint on control plane nodes, unless you tolerate all taints or that taint specifically your pod won't schedule there. It's pretty typical that a cluster with registered control plane nodes would have a similar taint if not the same taint.

@jkh52
Copy link
Contributor

jkh52 commented Jun 13, 2024

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 13, 2024
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 13, 2024
@carreter
Copy link
Contributor Author

Apologies for force-pushing and messing up the commit chain, I borked my local git repo.

Addressed review comments and made it so the script also sets the appropriate --server-count flag on the proxy server based on the number of requested KCP nodes (you can override and set it manually with --server-count-override <NUM>).

@cheftako
Copy link
Contributor

/lgtm
/approve
Thanks for adding these instructions!

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 20, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: carreter, cheftako

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 20, 2024
@k8s-ci-robot k8s-ci-robot merged commit c977ad8 into kubernetes-sigs:master Jun 20, 2024
6 checks passed
@carreter carreter deleted the kind-test branch June 20, 2024 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants