In this article, we will explore how to use Kubebuilder and Kind to create a local test cluster and an operator. Following that operation, we will then deploy that operator in the cluster and test it. All of the code is included below to port-forward to private endpoints the Kubernetes way. Also, if you want to learn more about the idea and the project check out the Forward operator page here.

Essentially, what the code does is to create an alpine/socat pod. You can specify the host, port, and protocol and it will make a tunnel for you, so then you can use port-forward or a service or ingress or whatever to expose things that are in another private subnet.

While this might not sound like a good idea at first, it does have some specific and essential use cases. Check your security constraints though before doing any of this⁠—though in a normal scenario it should be safe. In terms of use cases, this project is useful for testing or for reaching a database while doing some debugging or testing. The tools used in this project are what makes it really interesting as this is for building cloud native applications, since it native to Kubernetes, and that’s what we will explore here.

While Kind is not actually a requirement, I used that for testing and really liked it, it’s much faster and simpler than Minikube.

Also, if you are interested in how I came up with the idea to make this operator, check out this GitHub issue here.

#kubernetes #kind #kubebuilder

How to Build Cloud-Native Applications with Kubebuilder and Kind
4.90 GEEK