Skip to content

Minikube Cluster

Overview

This user journey guides you to install and verify the compatibility of Kuberarmor on Minikube by applying policies on Kubernetes workloads.

Step 1: Clone the Repository

git clone https://github.com/kubearmor/KubeArmor.git

Alt

Step 2: Install VirtualBox

cd KubeArmor/contribution/minikube
./install_virtualbox.sh

Alt

Note: Once VirtualBox installed, reboot the system.

sudo reboot

Step 3: Install Minikube

cd KubeArmor/contribution/minikube
./install_minikube.sh

Alt

./start_minikube.sh

Alt

Alt

Step 4: Karmor Install

Install Karmor CLI:

curl -sfL https://raw.githubusercontent.com/kubearmor/kubearmor-client/main/install.sh | sudo sh -s -- -b /usr/local/bin

Alt

karmor install

Alt

Karmor Verify:

karmor version

Alt

kubectl get pods -n kube-system | grep kubearmor

Alt

Step 5: KubeArmor Policy

1. Creating sample ubuntu deployment

kubectl apply -f ubuntu.yaml
kubectl get pods --show-labels

Alt

2. Apply the following policy

*use label of the deployment

cat ksp-block-sting-rhel-v-230335.yaml
apiVersion: security.kubearmor.com/v1
kind: KubeArmorPolicy
metadata:
  name: ksp-block-stig-rhel-v-230335
  namespace: default # Change your namespace
spec:
  tags: ["STIG","RHEL"]
  message: "Alert! /home/test.txt access will be Audit"
  selector:
    matchLabels:
      app: ubuntu # Change your matchLabels
  file:
    severity: 5
    matchPaths:
    - path: /home/test.txt
    action: Block

3. Apply the policy

kubectl apply -f ksp-block-sting-rhel-v-230335.yaml

Alt

4. Violating the policy

kubectl exec -it ubuntu-deployment-746964c6c6-j67jv bash

Alt

Step 6: Getting Alerts/Telemetry from KubeArmor

1. KubeArmor SVC port forward to Monitor the logs

kubectl port-forward -n kube-system svc/kubearmor 32767:32767

Alt

2. Verifying policy Violation logs

Karmor log

Alt

Back to top