Skip to content

Commit fcc3ecc

Browse files
authored
Merge pull request #327 from DataDog/simon.marechal/install-doc
(doc) More precise installation instructions
2 parents 16e785d + 4ab1167 commit fcc3ecc

File tree

3 files changed

+53
-8
lines changed

3 files changed

+53
-8
lines changed

README.md

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,9 @@ To run KubeHound, you need a couple dependencies
1313
+ [Docker](https://docs.docker.com/engine/install/) `>= 19.03`
1414
+ [Docker Compose](https://docs.docker.com/compose/compose-file/compose-versioning/) `V2`
1515

16-
### Install and run
16+
### Install
1717

18-
Select a target Kubernetes cluster, either:
19-
* Using [kubectx](https://github.com/ahmetb/kubectx)
20-
* Using specific kubeconfig file by exporting the env variable: `export KUBECONFIG=/your/path/to/.kube/config`
18+
#### From Release
2119

2220
Download binaries are available for Linux / Windows / Mac OS via the [releases](https://github.com/DataDog/KubeHound/releases) page or by running the following (Mac OS/Linux):
2321
```bash
@@ -32,10 +30,43 @@ If downloading the releases via a browser you must run e.g `xattr -d com.apple.q
3230

3331
</details>
3432

33+
#### With homebrew
34+
35+
KubeHound is available in homebrew-core and you can simply run
36+
```bash
37+
brew update && brew install kubehound
38+
```
39+
40+
`kubehound` should now be in your path.
41+
42+
#### From source
3543

36-
Then, simply run
44+
If you wish to build KubeHound from source, you will need to checkout a tag before building
3745
```bash
46+
git clone https://github.com/DataDog/KubeHound.git
47+
cd KubeHound
48+
git checkout $(git describe --tags --abbrev=0)
49+
make build
50+
```
51+
52+
KubeHound binary will be output to `./bin/build/kubehound`.
53+
54+
### Run
55+
56+
Select a target Kubernetes cluster, either:
57+
* Using [kubectx](https://github.com/ahmetb/kubectx)
58+
* Using specific kubeconfig file by exporting the env variable: `export KUBECONFIG=/your/path/to/.kube/config`
59+
60+
Then, simply run the `kubehound` binary:
61+
```bash
62+
# If you installed it from brew, it is in your path
63+
kubehound
64+
65+
# If you installed it from release, it should be were you downloaded it
3866
./kubehound
67+
68+
# If you installed it from source, it should be in the <repo_path>/bin/build folder
69+
./bin/build/kubehound
3970
```
4071

4172
For more advanced use case and configuration, see

docs/dev-guide/getting-started.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,23 @@ kubehound dev --down
5656
To build KubeHound locally from the sources, use the Makefile:
5757

5858
```bash
59+
# Ensure you are pulling a release tag
60+
git checkout tags/vX.X.X
61+
# Build the binary
5962
make build
6063
```
6164

65+
!!! note
66+
67+
While building the binary using a `main` revision, the binary will not be able
68+
to spin up the KubeHound stack. You should use a release tag to build the binary or
69+
use the `kubehound dev` command to spin up the dev stack.
70+
71+
!!! note
72+
73+
Being on a commit older than the latest one will also pull older images, to avoid dependency incompatibility.
74+
We strongly advise to use the latest tag to enjoy all features and performance improvements.
75+
6276
KubeHound binary will be output to `./bin/build/kubehound`.
6377

6478
### Releases

pkg/backend/project.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,9 @@ func loadEmbeddedDockerCompose(ctx context.Context, filepath string, dockerCompo
123123
// Setting the version tag for the release dynamically
124124
version := map[string]string{"VersionTag": config.BuildVersion}
125125

126-
// For local version (when the version is "dirty", using latest to have a working binary)
127-
// For any branch outside of main, using latest image as the current tag will cover (including the commit sha in the tag)
128-
if strings.HasSuffix(config.BuildBranch, "dirty") || config.BuildBranch != "main" {
126+
// If we are on a detached commit, we are probably on a release tag and git rev-parse --abbrev-ref HEAD will return "HEAD"
127+
// For any branch outside of main and the detached states, using latest image as the current tag will cover (including the commit sha in the tag)
128+
if config.BuildBranch != "main" && config.BuildBranch != "HEAD" {
129129
l.Warn("Loading the kubehound images with tag latest - dev branch detected")
130130
version["VersionTag"] = "latest"
131131
}

0 commit comments

Comments
 (0)