Skip to content

Commit 99e1e60

Browse files
feat: Docker image for installer and installation script improvements (#2)
* Added requirement for md5sum, and fixed check for existance having errors exit the script * Dockerfile for installer with AZ cli and prerequisites * Added uninstall script * Added instructions to use Docker image to install and uninstall
1 parent 9c4927a commit 99e1e60

File tree

3 files changed

+59
-9
lines changed

3 files changed

+59
-9
lines changed

Dockerfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM mcr.microsoft.com/azure-cli
2+
3+
RUN apk add gettext \
4+
&& az aks install-cli
5+
6+
WORKDIR /app
7+
8+
COPY ./install-aks-audit-log.sh .
9+
COPY ./uninstall-aks-audit-log.sh .
10+
11+
WORKDIR /data
12+
13+
ENTRYPOINT [ "/app/install-aks-audit-log.sh" ]

README.md

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,42 @@ This repository contains an installation/uninstallation script, instructions and
66

77
## Installation
88

9+
You can execute the automatic installation steps using a docker image that has all requirements, or directly using Bash if you already have the requirements in your system.
10+
11+
You need to know the AKS Cluster Name and the Resource Group Name that you used to create your [Azure AKS Cluster](https://docs.microsoft.com/en-us/azure/aks/kubernetes-walkthrough).
12+
13+
### A. Using Docker image installer
14+
15+
To execute the installer using a Docker image and sharing your Azure credentials with it, execute:
16+
17+
```bash
18+
docker run -it -v $HOME/.azure:/root/.azure sysdiglabs/aks-audit-log-installer:1 \
19+
-g YOUR_RESOURCE_GROUP_NAME -c YOUR_AKS_CLUSTER_NAME
20+
```
21+
22+
To see more optional parameters, use:
23+
24+
```bash
25+
docker run sysdiglabs/aks-audit-log-installer:1 --help
26+
```
27+
28+
### B. Using the Bash script
29+
930
The installation script has some command line tool requirements:
1031
* [Azure-cli](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest) (already logged into your account)
1132
* envsubst (shipped with gettext package)
1233
* kubectl
1334
* curl, tr, grep
1435

15-
You need to know the AKS Cluster Name and the Resource Group Name that you used to create your [Azure AKS Cluster](https://docs.microsoft.com/en-us/azure/aks/kubernetes-walkthrough).
1636

1737
```bash
1838
curl -s https://raw.githubusercontent.com/sysdiglabs/aks-audit-log/master/install-aks-audit-log.sh | \
1939
bash -s -- -g YOUR_RESOURCE_GROUP_NAME -c YOUR_AKS_CLUSTER_NAME
2040
```
2141

22-
To see more optional parameters, use
23-
```
42+
To see more optional parameters, use:
43+
44+
```bash
2445
curl -s https://raw.githubusercontent.com/sysdiglabs/aks-audit-log/master/install-aks-audit-log.sh | \
2546
bash -s -- --help
2647
```
@@ -43,6 +64,17 @@ kubectl log aks-audit-log-forwarder-XXXX -f
4364

4465
Use the same parameters as for installation. The script will delete all created resources and configurations.
4566

67+
Using Docker image:
68+
69+
```bash
70+
docker run -it -v $HOME/.azure:/root/.azure \
71+
--entrypoint /app/uninstall-aks-audit-log.sh \
72+
sysdiglabs/aks-audit-log-installer:1 \
73+
-g YOUR_RESOURCE_GROUP_NAME -c YOUR_AKS_CLUSTER_NAME
74+
```
75+
76+
Using uninstall Bash script:
77+
4678
```bash
4779
curl -s https://raw.githubusercontent.com/sysdiglabs/aks-audit-log/master/uninstall-aks-audit-log.sh | \
4880
bash -s -- -g YOUR_RESOURCE_GROUP_NAME -c YOUR_AKS_CLUSTER_NAME

install-aks-audit-log.sh

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,41 +5,46 @@ set -euf
55
function check_commands_installed {
66
echo "[1/12] Checking requirements"
77
local exists
8-
exists=$(which az)
8+
exists=$(which az ||:)
99
if [ "$exists" == "" ]; then
1010
echo "Required command line tool 'az' not available."
1111
echo "For instructions on how to install it, visit:"
1212
ecbo "https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest"
1313
exit 1
1414
fi
15-
exists=$(which kubectl)
15+
exists=$(which kubectl ||:)
1616
if [ "$exists" == "" ]; then
1717
echo "Required command line tool 'kubectl' not available."
1818
echo "Yoy may install it using:"
1919
echo " az aks install-cli"
2020
exit 1
2121
fi
22-
exists=$(which envsubst)
22+
exists=$(which envsubst ||:)
2323
if [ "$exists" == "" ]; then
2424
echo "Required command line tool 'envsubts' not available."
2525
echo "You may find it in the gettext or gettext-base packages."
2626
exit 1
2727
fi
28-
exists=$(which curl)
28+
exists=$(which curl ||:)
2929
if [ "$exists" == "" ]; then
3030
echo "Required command line tool 'curl' not available."
3131
exit 1
3232
fi
33-
exists=$(which tr)
33+
exists=$(which tr ||:)
3434
if [ "$exists" == "" ]; then
3535
echo "Required command line tool 'tr' not available."
3636
exit 1
3737
fi
38-
exists=$(which grep)
38+
exists=$(which grep ||:)
3939
if [ "$exists" == "" ]; then
4040
echo "Required command line tool 'grep' not available."
4141
exit 1
4242
fi
43+
exists=$(which md5sum ||:)
44+
if [ "$exists" == "" ]; then
45+
echo "Required command line tool 'md5sum' not available."
46+
exit 1
47+
fi
4348
}
4449

4550
function check_cluster {

0 commit comments

Comments
 (0)