1
0
mirror of https://github.com/aquasecurity/kube-bench.git synced 2024-12-20 21:58:06 +00:00
kube-bench/docs/installation.md
Dave Hay 42f479596c
doc(install): Adding detail and example for build (#928)
- Added to the `Installing from sources`
- Includes `git clone` etc.
- Also includes comments

Signed-off-by: Dave Hay <david_hay@uk.ibm.com>
2021-07-07 10:56:33 +03:00

3.6 KiB
Raw Blame History

Installation

You can choose to

Download and Install binaries

It is possible to manually install and run kube-bench release binaries. In order to do that, you must have access to your Kubernetes cluster nodes. Note that if you're using one of the managed Kubernetes services (e.g. EKS, AKS, GKE, ACK, OCP), you will not have access to the master nodes of your cluster and you cant perform any tests on the master nodes.

First, log into one of the nodes using SSH.

Install kube-bench binary for your platform using the commands below. Note that there may be newer releases available. See releases page.

Ubuntu/Debian:

curl -L https://github.com/aquasecurity/kube-bench/releases/download/v0.6.2/kube-bench_0.6.2_linux_amd64.deb -o kube-bench_0.6.2_linux_amd64.deb

sudo apt install ./kube-bench_0.6.2_linux_amd64.deb -f

RHEL:

curl -L https://github.com/aquasecurity/kube-bench/releases/download/v0.6.2/kube-bench_0.6.2_linux_amd64.rpm -o kube-bench_0.6.2_linux_amd64.rpm

sudo yum install kube-bench_0.6.2_linux_amd64.rpm -y

Alternatively, you can manually download and extract the kube-bench binary:

curl -L https://github.com/aquasecurity/kube-bench/releases/download/v0.6.2/kube-bench_0.6.2_linux_amd64.tar.gz -o kube-bench_0.6.2_linux_amd64.tar.gz

tar -xvf kube-bench_0.6.2_linux_amd64.tar.gz

You can then run kube-bench directly:

kube-bench

If you manually downloaded the kube-bench binary (using curl command above), you have to specify the location of configuration directory and file. For example:

./kube-bench --config-dir `pwd`/cfg --config `pwd`/cfg/config.yaml 

See previous section on Running kube-bench for further details on using the kube-bench binary.

Installing from sources

If Go is installed on the target machines, you can simply clone this repository and run as follows (assuming your GOPATH is set) as per this example:

# Create a target directory for the clone, inside the $GOPATH
mkdir -p $GOPATH/src/github.com/aquasecurity/kube-bench

# Clone this repository, using SSH
git clone git@github.com:aquasecurity/kube-bench.git $GOPATH/src/github.com/aquasecurity/kube-bench

# Install the pre-requisites
go get github.com/aquasecurity/kube-bench

# Change to the kube-bench directory
cd $GOPATH/src/github.com/aquasecurity/kube-bench

# Build the kube-bench binary
go build -o kube-bench .

# See all supported options
./kube-bench --help

# Run all checks
./kube-bench

Installing from a container

This command copies the kube-bench binary and configuration files to your host from the Docker container: binaries compiled for linux-x86-64 only (so they won't run on macOS or Windows)

docker run --rm -v `pwd`:/host aquasec/kube-bench:latest install

You can then run ./kube-bench.