Crossplane development environment using kind (Kubernetes-in-Docker).
kubectl
helm
v3go
(or alternativelykind
)docker
Short version:
make vshnpostgresql
This will
- Install a local Kubernetes cluster with kubernetes-in-docker (
kind
) - Install Crossplane Helm chart
- Install Secrets Generator Helm chart (for providing random passwords)
- Install StackGres Operator
- Install Prometheus Operator and a Prometheus instance with AlertManager
To uninstall the cluster:
make clean
The kind cluster features an ingress controller, that listens on :8088
.
Currently following apps are configured to use the ingress:
- Promethues: http://prometheus.127.0.0.1.nip.io:8088/
- Alertmanager: http://alertmanager.127.0.0.1.nip.io:8088/
- Minio: http://minio.127.0.0.1.nip.io:8088/
- Komoplane (make komoplane-setup): http://komoplane.127.0.0.1.nip.io:8088/
- Forgejo: http://forgejo.127.0.0.1.nip.io:8088/
- ArgoCD: http://argocd.127.0.0.1.nip.io:8088/
For minio access from the localhost just use this alias:
mc alias set localnip http://minio.127.0.0.1.nip.io:8088 minioadmin minioadmin
Minio console access: http://minio-gui.127.0.0.1.nip.io:8088
To toggle the vcluster support please use -e vcluster=true
. Any make target that has support for the vcluster will then automatically use the vcluster.
There are also some helper targets for the vcluster:
- vcluster-clean: will remove the vluster. Helpful if Crossplane broke completely
- vcluster-in-cluster-kubeconfig: generates a kubeconfig that can be used from within the main cluster. E.g. when deploying the controller or sli-exporter so it can connect to the control plane.
- vcluster-local-cluster-kubeconfig: same as the above, but will point to the vcluster proxy endpoint. Useful for debugging purpose.
If you need to install something in the control cluster in make, you can do it like this:
.PHONY: app-setup
app-setup:
$(vcluster_bin) connect controlplane --namespace vcluster
$install what you need
$(vcluster_bin) disconnect
If you need access to the vcluster from outside make (for example, when applying the AppCat component or other things). Export the kind config and then:
kubectl config get-contexts
# get the vcluster context
# it's the one starting with vcluster_*
kubectl config use-context vcluster_*...
kindev is intended to be used by Crossplane providers as a developement and test environment. It can be tied into other projects via a git submodule.
Run inside the git repository of your project:
git submodule add https://github.com/vshn/kindev.git
It is built to work in CI/CD environments. This is an example GitHub workflow to show kindev usage in your project.
name: Demo
on:
push:
branches:
- master
env:
KIND_CMD: kind # kind is pre-installed in GitHub runners
KUBECONFIG: 'kindev/.kind/kind-kubeconfig-v1.23.0'
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true # required for submodules
- name: Crossplane setup
working-directory: kindev
run: make crossplane-setup
- name: Your test
run: kubectl ...