Testing Guide
Testing Guide
There are two ways to check the functionalities of KubeArmor: 1) testing KubeArmor manually and 2) using the testing framework.
0. Make sure that the annotation controller is installed on the cluster (Applicable for Steps 1 and 2)
To install the controller from KubeArmor docker repository to your cluster run
To install the controller (local version) to your cluster run
1. Test KubeArmor manually
1.1. Run 'kubectl proxy' in background
1.2. Compile KubeArmor
1.3. Run KubeArmor
1.4. Apply security policies into Kubernetes
Beforehand, check if the KubeArmorPolicy and KubeArmorHostPolicy CRDs are already applied.
If they are still not applied, do so.
Now you can apply specific policies.
You can refer to security policies defined for example microservices in examples.
1.5. Trigger policy violations to generate alerts
1.6. Check generated alerts
Watch alerts using karmor cli tool
flags:
Note that you will see alerts and logs generated right after
karmor
runs logs; thus, we recommend to run the above command in other terminal to see logs live.
2. Test KubeArmor using the auto-testing framework
2.1. Prepare microservices and test scenarios
The auto-testing framework operates based on two things: microservices and test scenarios for each microservice.
Microservices
Create a directory for a microservice in microservices
Then, create YAML files for the microservice
As an example, we created 'multiubuntu' in microservices and defined 'multiubuntu-deployment.yaml' in multiubuntu.
Test scenarios
Create a directory whose name is like '[microservice name]_[scenario name]' in scenarios
Then, define a YAML file for a test policy in the directory
Create cmd files whose names are like 'cmd#'
Here is a template for a cmd file.
This is a cmd example of a test scenario.
You can refer to predefined testcases in scenarios.
2.2. Test KubeArmor
The case that KubeArmor is directly running in a host
Compile KubeArmor
Run the auto-testing framework
Check the test report
The case that KubeArmor is running as a daemonset in Kubernetes
Run the testing framework
Check the test report
Last updated