Skip to content

Latest commit

 

History

History
167 lines (113 loc) · 4.47 KB

README.md

File metadata and controls

167 lines (113 loc) · 4.47 KB

Getting Started

A quick start guide to get Kepler up and running.

Pre-requisites

This guide assumes you have the following installed:

In order to make contributions to Kepler, 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

Create a new ephemeral local kubernetes cluster

Use make cluster-up to setup a local development cluster running in Kind.

The make target cluster-up works by cloning local-dev-cluster repo locally and using the scripts in the repo to setup a Kubernetes running locally using Kind.

NOTE: Considering that your local environment is different to CI, we strongly recommend that you check prerequisites and start up to customize your own local development environment.

You can find technical discussions within the community regarding this topic by following this enhancements proposal and related issue.

Build and run Kepler on your cluster

make cluster-deploy

Make target cluster-deploy does the following

  • Build the necessary manifests.
  • Build and Push the Kepler image to local registry.
  • Deploys Kepler with the newly created image.
  • Validate Kepler installation.

If you want to use container registry of your choice:

make cluster-deploy IMAGE_REPO=index.docker.io/myrepo IMAGE_TAG=mybuild NO_BUILD=true

If you want to run Kepler with privileged setup:

make cluster-deploy IMAGE_REPO=index.docker.io/myrepo IMAGE_TAG=mybuild OPTS=ROOTLESS NO_BUILD=true

To run Kepler externally to the cluster

This quick tutorial is for developing and testing Kepler locally but with access to kubelet

Install bcc-devel and kernel-devel

Refer to the builder Dockerfile

Compile

Go to the root of the repo and do the following:

make _build_local

If successful, the binary is at _output/bin/_/kepler

Test

Create the k8s role and token, copy data files, this is only needed once.

cd dev/
./create_k8s_token.sh
./prepare_dev_env.sh

Then run the Kepler binary at _output/bin/_/kepler

Kepler metrics are available under <host_ip>:8888/metrics by default

Build kepler and base multi-arch images

./hack/build-images.sh help

Profiling Kepler

kepler exposes standard go profiling endpoint at /debug/pprof/profile. Following examples show how to profile kepler with go tool pprof.

NOTE: These examples assume kepler is running (or port-forwarded in case of k8s) on localhost:8888.

Detailed information about using pprof can be found in their documentation.

CPU Profiling

go tool pprof 'http://localhost:8888/debug/pprof/profile?seconds=30'

Memory (heap) Profiling

go tool pprof 'http://localhost:8888/debug/pprof/heap?seconds=30'

Visualizing pprof

-http option can be used to visualize existing pprof in

go tool pprof -http 0.0.0.0:8000 'http://localhost:8888/debug/pprof/heap?seconds=30'

or

go tool pprof -http 0.0.0.0:8000 <path/to/pprof-capture >.pb.gz