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

[WIP] Kind cloud-provider to manage loadbalancers #3103

Closed
wants to merge 2 commits into from

Conversation

aojea
Copy link
Contributor

@aojea aojea commented Feb 18, 2023

These feature try to solve two important issues:

  1. lack of testing on cloud-providers in Kubernetes

Current e2e test for cloud-providers has plenty of customization, the lack of agnostic e2e tests on this area makes that the migration to out-of-tree cloud-providers can drift providing a very bad user experience and non-portable configurations.

Kind has demonstrated several times its versatility and capacity to develop agnostic e2e tests.

  1. difficult to expose Services on Kind clusters

This is a long standing demand, users need to come with complex and convoluted solutions to expose Services, having an out-of-the-box and realistic capacity to expose Service will improve the UX.

How to use it

  1. Run a kind cluster enabling the Cloud Controller Manager CCM
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
networking:
  enableCCM: true
nodes:
- role: control-plane
- role: worker
kind create cluster --config kind.yaml
  1. Create a Service with a Loadbalancer
kubectl apply -f https://raw.githubusercontent.com/aojea/cloud-provider-kind/main/examples/loadbalancer_etp_local.yaml
  1. Check the loadbalancer IP address
$ kubectl get services
NAME               TYPE           CLUSTER-IP     EXTERNAL-IP   PORT(S)        AGE
kubernetes         ClusterIP      10.96.0.1      <none>        443/TCP        11h
lb-service-local   LoadBalancer   10.96.159.62   192.168.8.8   80:30942/TCP   11h

  1. Connect to your exposed Service in the Loadbalancer IP
$ curl http://192.168.8.8/hostname
policy-local-57cd6f44c8-s2fmb

Demo

Sig-Network meeting on 16 Febr 2023 https://www.youtube.com/playlist?list=PL69nYSiGNLP2E8vmnqo5MwPOY25sDWIxb

Prototype

https://github.com/aojea/cloud-provider-kind/

Fixes: #3086
Fixes: #702
Related: kubernetes/kubernetes#73794

Implement an external cloud provider for kind clusters.

The cloud-provider received the name of the kind cluster, and
automatically pulls the kubeconfig from the control plane.

It implements the InstancesV2() and LoadBalancer() internfaces
of k8s.io/cloud-provider.

The LoadBalancer creates haproxy containers and configures them
accordenly.

This version only supports linux, but next version will support
platforms that run into VMs (Mac, windows, ...) by exposing
the loadbalancer containers via port-forwards.

The InstancesV2() option requires to configure kubelet with the
flag --cloud-provider external and remove the --node-ip flags,
something that has to be done manually on kind.
It adds an option on the kind configuration, under the networking
section, to enable the kind cloud controller manager.

The section is under networking because the only functionality
that can be used out of the box are the loadbalancers.
@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Feb 18, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: aojea

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 Feb 18, 2023
@k8s-ci-robot k8s-ci-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Feb 18, 2023
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 22, 2023
@k8s-ci-robot
Copy link
Contributor

PR needs rebase.

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.

@aojea
Copy link
Contributor Author

aojea commented Mar 1, 2023

this will be better standalone

kubernetes/org#4052

@aojea aojea closed this Mar 1, 2023
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. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a kind cloud-provider Kind Load Balancer
3 participants