This repo provides the scripts to create a local kubernetes cluster to be used for development or integration tests. It is also used in Github action for kepler.
- kubectl
- kind
- Git
- OPTIONAL: pre-commit
Please install the same version of kubectl
and kind
as Github-hosted runner.
Currently Kepler project's Github Action only supports Ubuntu
based runners.
You can refer to tools list here
./main.sh prerequisites
Will setup ebpf on your host instance.
./main.sh containerruntime
Will setup container runtime on your host instance.
Note: in 2024 July, we decoupled cluster config with kind cluster setup, so that we allow this repo to set up a existing cluster.
-
Modify kind config to make sure
extraMounts:
cover the linux header and BCC. -
To setup local env run:
./main.sh up ./main.sh config
-
To tear down local env run:
./main.sh down
Alternatively, use
.env
file to define and override the default configuration variables. E.g#.env PROMETHEUS_ENABLE=false GRAFANA_ENABLE=false TEKTON_ENABLE=false KUBEVIRT_ENABLE=false
Start the cluster by running
./main.sh up ./main.sh config
There's a container registry available which is exposed at localhost:5001
.
To set up a local cluster for kepler development, we need to make the cluster connected with a local container registry.
- Check kubectl version.
- Check k8s cluster provider's version(as KIND).
- Check prometheus operator version.
Please feel free to refer to kind provider implementation to contribute a k8s cluster. Please ensure that these checklist are statisfies as Kepler requires certain feature to be available.
-
The provider related script should be placed under
'./provider/<name>/<name.sh>'
-
The script should have a
<provider>_up
function that sets up the k8s cluster. -
The script should have a
<provider>_down
function that deletes the cluster. -
The script should have a
<provider>_kubeconfig
function that prints the path to the cluster's kubeconfig that is located on host machine. Consider usingtmp/<provider>/kubeconfig
as the path to create/copy the kubeconfig file. -
Ensure cluster can pull from the local specific registry since for local development, we expect to push the development image to the local registry instead of a public registry.
-
Mount local path of linux kernel and ebpf(BCC) inside kepler pod.
In order to make contributions to this repo, you need to have the following installed:
You can install pre-commit by running the following command:
pip install pre-commit
After installing pre-commit, you need to install the pre-commit hooks by running the following command:
pre-commit install
To run pre-commit manually
pre-commit run --all-files
To skip pre-commit checks, use the --no-verify
flag when committing changes
git commit -m "test" --no-verify
[precommit-shellcheck-mardown 89ed1adc] test
1 file changed, 1 insertion(+), 1 deletion(-)