Kube-Scan: Your Free Kubernetes Risk Assessment Tool

Jul 19, 2022 | Programming

In today’s digital landscape, securing your Kubernetes cluster is paramount. Introducing Kube-Scan, a straightforward and effective tool that assesses the risk levels of your workloads within Kubernetes. Whether you’re an experienced developer or just starting your journey in container orchestration, this guide will provide you with all you need to know about deploying and using Kube-Scan effortlessly.

Getting Started with Kube-Scan

Before you dive into the details, it’s important to understand what Kube-Scan does. Think of a Kubernetes cluster like a bustling city, where each application is a building. Kube-Scan acts as a vigilant inspector, evaluating each building’s safety and ensuring all are compliant with regulations.

As the inspector conducts its evaluation, it assigns a risk score to each building (workload) based on its current configuration. This score ranges from 0 (no risk) to 10 (high risk), offering a clear insight into which applications need attention. It evaluates over 20 settings to deliver a comprehensive risk assessment.

Quickstart Guide

To get Kube-Scan running, follow these simple steps:

  • Apply the Kube-Scan configuration:
  • kubectl apply -f https://raw.githubusercontent.com/octarineseck/kube-scan/master/kube-scan.yaml
  • Set up port forwarding:
  • kubectl port-forward --namespace kube-scan svc/kube-scan-ui 8080:80
  • Now, open your browser and navigate to http://localhost:8080.

Using a Load-Balancer Service

If you’re using a cloud provider that supports load balancers, follow these steps:

  • Deploy using the load balancer configuration:
  • kubectl apply -f https://raw.githubusercontent.com/octarineseck/kube-scan/master/kube-scan-lb.yaml
  • Fetch the load balancer’s address:
  • kubectl -n kube-scan get service kube-scan-ui -o jsonpath='{.status.loadBalancer.ingress[0].ip}'
    # or for hostname
    kubectl -n kube-scan get service kube-scan-ui -o jsonpath='{.status.loadBalancer.ingress[0].hostname}'
  • Open your browser and set the address accordingly.

Interacting with the API

If you’ve set up Kube-Scan with a load balancer, the following API calls will be useful:

  • Get all the risks in your cluster:
  • GET http://HOST/api/risks
  • To refresh the risk calculations after changes:
  • POST http://HOST/api/refresh
  • To check the status of the refresh operation:
  • GET http://HOST/api/refreshing_status

Building from Source Code

If you want to customize Kube-Scan, you can build it from source. Here’s how:

  • Build the server image:
  • cd server
    docker build -t SERVER_TAG_NAME . 
    docker push SERVER_TAG_NAME
  • Build the client image:
  • cd client
    docker build -t CLIENT_TAG_NAME .
    docker push CLIENT_TAG_NAME
  • Set the kube-scan container images in the desired YAML file and deploy.

Uninstalling Kube-Scan

If you need to uninstall Kube-Scan for any reason, use the following commands:

  • To remove the basic installation:
  • kubectl delete -f https://raw.githubusercontent.com/octarineseck/kube-scan/master/kube-scan.yaml
  • If using a load balancer:
  • kubectl delete -f https://raw.githubusercontent.com/octarineseck/kube-scan/master/kube-scan-lb.yaml

Troubleshooting Tips

If you encounter issues while using Kube-Scan, here are some troubleshooting strategies:

  • Ensure that Kubernetes is running correctly and you have the necessary permissions.
  • Check the logs of the Kube-Scan pod using:
  • kubectl logs -n kube-scan 
  • Verify that you have set the correct image names in your YAML files.
  • If you need additional help or insights, for more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.

Concluding Thoughts

Kube-Scan is a powerful tool to ensure your Kubernetes workloads remain secure and compliant. With its risk scoring and easy-to-follow setup, you can keep your applications in check like a seasoned inspector. At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.

Stay Informed with the Newest F(x) Insights and Blogs

Tech News and Blog Highlights, Straight to Your Inbox